Skip to content

Reuse token cache until the server rejects it - #7

Merged
guantw merged 1 commit into
masterfrom
codex/reuse-token-cache-until-rejected
Aug 29, 2026
Merged

Reuse token cache until the server rejects it#7
guantw merged 1 commit into
masterfrom
codex/reuse-token-cache-until-rejected

Conversation

@guantw

@guantw guantw commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Changes

  • Remove the creation-date gate from the Token cache so cached credentials can be reused across days.
  • Refresh the Access Token only when an authenticated Huawei API request returns 401 or code=4000, then retry the original request.
  • Keep the existing same-day, bundle, capability-mode, and device-UDID validation for signing-material caches unchanged.
  • Update the CLI wording, README, agent signing guide, security guidance, and changelog, and add regression coverage for reusing older Token caches.

Validation

  • python -m ruff format --check .
  • python -m ruff check .
  • python -m pytest --cov (266 passed, 2 skipped, 78% coverage)
  • New and changed behavior is covered without requiring a real account or device
  • User-visible changes are documented in CHANGELOG.md
  • No tokens, certificates, private keys, UDIDs, HAPs, logs, or local configuration are committed
  • No dependencies were added, so THIRD_PARTY_NOTICES.md does not require an update
  • Portable packaging is unaffected, so no additional docs/OPEN_SOURCE_RELEASE.md review is required

Manual Testing

No real Huawei account or device was used. Unit tests cover reusing the Token cache, avoiding refresh after successful requests, and refreshing and retrying after server rejection.

Remove the creation-date gate from token cache loading so cached credentials can be reused across days. Refresh the access token only after an authenticated API request reports that it is invalid, while keeping signing-material cache expiry unchanged.

Update CLI wording, user and agent documentation, security guidance, changelog entries, and regression tests for the new cache behavior.

Validation: python -m ruff format --check .; python -m ruff check .; python -m pytest --cov (266 passed, 2 skipped, 78% coverage).
@guantw
guantw merged commit 846191e into master Aug 29, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant