Repository navigation
fix(proxy): cap selector "Try again in" hint at 300s - #690
Merged
Merged
Conversation
When select_account cannot return a candidate, the surfaced
"Rate limit exceeded. Try again in {N}s" hint was driven directly by
min(reset_at) of the quota_exceeded pool or min(cooldown_until) of the
all-states pool. After OpenAI-side "team reset events" where /wham/usage
propagates lazily (see #676, #678), N can reach ~89,872s (~25 hours)
even though codex-lb's own 60s usage refresh would auto-recover the
account much sooner. Clients (Codex CLI, OpenCode, OpenClaw) then back
off for hours when the actual recovery window is minutes.
Cap the surfaced wait at SELECTOR_RETRY_HINT_MAX_SECONDS=300 so clients
reattempt inside the auto-recovery window. AccountState.reset_at and
AccountState.cooldown_until are unchanged and continue to drive selection,
telemetry, and dashboard reads — only the user-visible string is clamped.
Refs: Soju06/codex-lb#676
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Collaborator
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Owner
|
@all-contributors please add @AnobleSCM for code, test |
Contributor
|
I've put up a pull request to add @AnobleSCM! 🎉 |
Soju06
added a commit
that referenced
this pull request
May 19, 2026
## [1.18.2](v1.18.1...v1.18.2) (2026-05-19) ### Bug Fixes * **api-keys:** map enforced service_tier auto/default to outbound omission ([#611](#611)) ([9a64e23](9a64e23)) * **api-keys:** size usage reservations from request budget ([#706](#706)) ([ea72eea](ea72eea)) * **dashboard:** derive quota status from usage windows ([#686](#686)) ([c463def](c463def)) * **dashboard:** make weekly credit pace backend-driven ([#692](#692)) ([313783c](313783c)) * **db:** recover stale reservations and serialize sqlite writers ([#667](#667)) ([6635628](6635628)) * **model-refresh:** refresh HTTP client on transport errors ([#547](#547)) ([2087df0](2087df0)) * **models:** report full context in v1 metadata ([#681](#681)) ([c3c977d](c3c977d)) * **proxy:** cap selector "Try again in" hint at 300s ([#690](#690)) ([cf09bd6](cf09bd6)), closes [#676](#676) [#678](#678) * **proxy:** eliminate /v1 responses cancel/retry stream contamination ([#696](#696)) ([c9da497](c9da497)) * **proxy:** harden long Codex websocket turns ([#674](#674)) ([12bec0f](12bec0f)) * **proxy:** include sticky thread in budget-pressure guard ([#514](#514)) ([1e2c6d6](1e2c6d6)) * **proxy:** keep idle timeout classification after scheduler jitter ([#693](#693)) ([17e8abc](17e8abc)) * **proxy:** mask partial previous-response stream errors ([#689](#689)) ([a4a138c](a4a138c)) * **proxy:** persist request logs outside cancellation ([#688](#688)) ([6e8fa56](6e8fa56)) * **proxy:** repair interrupted Codex response continuity ([#698](#698)) ([682447f](682447f)) * **proxy:** trim durable full-resend continuations ([#687](#687)) ([dfc38c0](dfc38c0)) * **security:** remediate Docker code scanning alerts ([#699](#699)) ([de24c2e](de24c2e)) ### Documentation * add AnobleSCM as a contributor for code, and test ([#695](#695)) ([718931e](718931e)) * add jgorostegui as contributor ([#697](#697)) ([d9d5a6e](d9d5a6e)) * add linusmixson as contributor ([#705](#705)) ([f3ad60a](f3ad60a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
6 tasks
vitalNohj
pushed a commit
to vitalNohj/codex-lb
that referenced
this pull request
Jul 17, 2026
Cap the user-visible selector retry hint at 300s when no accounts are selectable, without changing underlying reset/cooldown state. Refs Soju06#676 Refs Soju06#678
vitalNohj
pushed a commit
to vitalNohj/codex-lb
that referenced
this pull request
Jul 17, 2026
## [1.18.2](Soju06/codex-lb@v1.18.1...v1.18.2) (2026-05-19) ### Bug Fixes * **api-keys:** map enforced service_tier auto/default to outbound omission ([Soju06#611](Soju06#611)) ([ce0d1ea](Soju06@ce0d1ea)) * **api-keys:** size usage reservations from request budget ([Soju06#706](Soju06#706)) ([f3b1689](Soju06@f3b1689)) * **dashboard:** derive quota status from usage windows ([Soju06#686](Soju06#686)) ([acb4133](Soju06@acb4133)) * **dashboard:** make weekly credit pace backend-driven ([Soju06#692](Soju06#692)) ([383ccd4](Soju06@383ccd4)) * **db:** recover stale reservations and serialize sqlite writers ([Soju06#667](Soju06#667)) ([79dced5](Soju06@79dced5)) * **model-refresh:** refresh HTTP client on transport errors ([Soju06#547](Soju06#547)) ([f0b38a0](Soju06@f0b38a0)) * **models:** report full context in v1 metadata ([Soju06#681](Soju06#681)) ([82bd538](Soju06@82bd538)) * **proxy:** cap selector "Try again in" hint at 300s ([Soju06#690](Soju06#690)) ([1242bc1](Soju06@1242bc1)), closes [Soju06#676](Soju06#676) [Soju06#678](Soju06#678) * **proxy:** eliminate /v1 responses cancel/retry stream contamination ([Soju06#696](Soju06#696)) ([d7f3cea](Soju06@d7f3cea)) * **proxy:** harden long Codex websocket turns ([Soju06#674](Soju06#674)) ([0828e63](Soju06@0828e63)) * **proxy:** include sticky thread in budget-pressure guard ([Soju06#514](Soju06#514)) ([e9d5b84](Soju06@e9d5b84)) * **proxy:** keep idle timeout classification after scheduler jitter ([Soju06#693](Soju06#693)) ([0860872](Soju06@0860872)) * **proxy:** mask partial previous-response stream errors ([Soju06#689](Soju06#689)) ([4563488](Soju06@4563488)) * **proxy:** persist request logs outside cancellation ([Soju06#688](Soju06#688)) ([684b1dc](Soju06@684b1dc)) * **proxy:** repair interrupted Codex response continuity ([Soju06#698](Soju06#698)) ([0e8232a](Soju06@0e8232a)) * **proxy:** trim durable full-resend continuations ([Soju06#687](Soju06#687)) ([e017bfc](Soju06@e017bfc)) * **security:** remediate Docker code scanning alerts ([Soju06#699](Soju06#699)) ([1b012f6](Soju06@1b012f6)) ### Documentation * add AnobleSCM as a contributor for code, and test ([Soju06#695](Soju06#695)) ([e95cfca](Soju06@e95cfca)) * add jgorostegui as contributor ([Soju06#697](Soju06#697)) ([4974c52](Soju06@4974c52)) * add linusmixson as contributor ([Soju06#705](Soju06#705)) ([ed41ae0](Soju06@ed41ae0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When `select_account` cannot return a candidate, the surfaced `Rate limit exceeded. Try again in {N}s` value is currently driven directly by `min(reset_at)` of the quota-exceeded pool (or `min(cooldown_until)` of all states) — see `app/core/balancer/logic.py:227-235`. After OpenAI-side reset events where `/wham/usage` propagates lazily (the same pattern documented in #676 / #677 / #678), `N` can reach ~89,872s (~25h). Clients (Codex CLI, OpenCode, OpenClaw) then back off for hours when codex-lb's own 60s `/wham/usage` refresh + 120s per-status cooldown threshold would have recovered the account inside a 5-minute window.
This change caps the user-visible retry hint at `SELECTOR_RETRY_HINT_MAX_SECONDS = 300`. `AccountState.reset_at` and `AccountState.cooldown_until` are unchanged and continue to drive selection, telemetry, and dashboard reads — only the string returned alongside `SelectionResult(account=None, ...)` is clamped.
This is the operator-facing UX gap that fed several of the reports in #676 / #678: operators see a "wait 25 hours" message and assume they are hard-blocked, when in reality codex-lb will auto-recover on the next refresh tick. With the clamp, clients reattempt inside the auto-recovery window and the symptom resolves naturally.
Test plan
OpenSpec change folder: `openspec/changes/clamp-selector-retry-hint/` (modifies the `query-caching` capability spec to add the clamp scenarios).
Notes
🤖 Generated with Claude Code