Skip to content

Retry account switches after usage limits#212

Merged
cbusillo merged 1 commit into
mainfrom
fix/account-switch-runtime-retry
Jun 25, 2026
Merged

Retry account switches after usage limits#212
cbusillo merged 1 commit into
mainfrom
fix/account-switch-runtime-retry

Conversation

@cbusillo

Copy link
Copy Markdown
Owner

Summary

  • retry a sampling request after switching saved accounts on typed UsageLimitReached responses
  • keep runtime rate-limit switch state for the whole turn so exhausted ChatGPT accounts are not reselected across follow-up sampling rounds
  • add limited ChatGPT account tracking and API-key fallback gating for no-reset/stale-reset limit responses

Good PRs passed on the way

Aligns With #126

This closes the next auth/account-switching audit miss after #211: runtime retry switching on UsageLimitReached plus RateLimitSwitchState fallback semantics. Plain saved API-key-to-saved-API-key rotation remains a follow-up because cached API-key auth does not currently expose a saved account id through the same path.

Validation

  • cargo check -p codex-core --lib
  • cargo test -p codex-core account_switching::tests::limited_chatgpt_account_is_not_reselected_without_reset_hint --lib -- --exact
  • cargo test -p codex-core account_switching::tests::limited_chatgpt_account_is_not_reselected_after_expired_reset_hint --lib -- --exact
  • cargo test -p codex-core account_switching::tests::api_key_fallback_requires_all_chatgpt_accounts_marked_limited --lib -- --exact

Refs #126

@cbusillo cbusillo merged commit eb7890f into main Jun 25, 2026
10 checks passed
@cbusillo cbusillo deleted the fix/account-switch-runtime-retry branch June 25, 2026 19:07
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