You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rotate to another account of the same provider on HTTP 429 before failing over to the next provider #7426
Wear-level the quota of several accounts registered for the SAME provider (in our production setup, multiple Antigravity accounts behind one combo route) so a route only degrades to a different provider after the provider's own accounts are exhausted.
What prevents this today?
On HTTP 429 from the selected account, the combo makes a single attempt and fails over to the NEXT PROVIDER instead of trying another account of the same provider first. One hot account therefore ejects the whole route from its best provider while sibling accounts still have quota.
What should OpenCodex do?
When a provider returns 429 (or an equivalent quota signal), retry the request against another healthy account of the same provider, honoring per-account cooldowns, and only fail over to the next provider in the combo when no account of the current provider is available.
Example usage or interface
Combo route: [antigravity (accounts A, B, C, D), provider-2]
Request -> account A -> 429 (quota) -> retry account B -> 200 OK
Failover to provider-2 only after A-D are all in cooldown.
No configuration change should be required; rotation is the observable behavior of the account pool.
Alternatives or workarounds
Splitting accounts across duplicated combo routes and reordering providers manually. This fragments routing, complicates effort/model mapping, and still cannot react to a 429 at request time.
Additional context
Observed in production on OpenCodex 2.84.0 (VM) fronting all of our Codex traffic. Reported by RHODIZ IT LLC.
Checks
I searched existing issues and documentation.
This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.
Create Plan
🧪 Issue enrichment is currently in open beta.
To disable automatic issue enrichment, add the following to your .coderabbit.yaml:
issue_enrichment:
auto_enrich:
enabled: false
💬 Have feedback or questions? Drop into our discord!
Checked against trusted dev 12025981e5a304cdb6b1b54f525ba8554f623977. Current adapter dispatch already has rotateGenericOAuthAccountOn429 and separate key/Anthropic rotation owners before combo fallback. The 2.84.0 observation therefore needs a current-head path distinction, not another generic retry loop. Please provide redacted pool enablement/strategy, error code and account-versus-target cooldown scope, whether output was committed, and attempted-account count. Exact bindings, non-replayable output and the shared physical-send budget must still stop rotation. No sibling-account quota probe or credential/config change was made here.
Opened #7471 for the Command Code path distinction requested here.
Command Code reports exhausted credits as HTTP 400 (success: false, error.code: "BAD_REQUEST", message prefix You have insufficient credits to make this request.). The PR normalizes only that exact refusal to 429, preserves the original body and upstream status in headers, and lets the existing rotateGenericOAuthAccountOn429 path rotate to a sibling account. No new retry loop.
Local two-account check on 2.88.0: the first account returned the exact 400 refusal, the next account returned 200 / completed / OK, and the following turn stayed on the second account with one send. Focused tests: 6 pass / 43 assertions; typecheck and privacy scan pass. Account identifiers, tokens, and request IDs are omitted.
Verified against current dev (2b5148b): a combo target backed by a pooled OAuth provider already rotates to another account of the same provider on a 429 before the combo hops to the next provider. Combo children run the ordinary concrete-provider dispatch, and its account recovery runs before combo failure handling sees the error.
Provider path
Rotation on 429
Regression coverage
Generic OAuth (incl. Antigravity)
src/server/responses/adapter-dispatch.ts 429 loop selects an eligible sibling, applies its full credential snapshot and resends; Antigravity also filters siblings by model roster
tests/oauth/oauth-account-attribution.test.ts, tests/oauth/generic-oauth-combo-account-cooldown.test.ts (sends A, A, B before any provider fallback), tests/server/server-google-antigravity-oauth-429-budget.test.ts
pre-stream quota refusal moves to an alternate account
tests/server/server-auth.test.ts
Recovery stays bounded on purpose: one request funds at most six account attempts, and Codex makes one alternate move under its fixed-selector and uploaded-file guards. A request can therefore still hop after a bounded number of exhausted accounts while a later sibling is healthy. That later sibling stays eligible for the next request because account exhaustion cools only the failing combo target, which #7625 keeps target-scoped.
Closing as already implemented. If you still see an immediate provider hop on 2.94.x with a healthy sibling account, please open a new report with the request log rows (account labels redacted).
Activity
github-actions commentedon Oct 20, 2026
Automated translation bookkeeping — detected language: English.
coderabbitai commentedon Oct 20, 2026
📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
Ingwannu commentedon Oct 20, 2026
Checked against trusted dev
12025981e5a304cdb6b1b54f525ba8554f623977. Current adapter dispatch already has rotateGenericOAuthAccountOn429 and separate key/Anthropic rotation owners before combo fallback. The 2.84.0 observation therefore needs a current-head path distinction, not another generic retry loop. Please provide redacted pool enablement/strategy, error code and account-versus-target cooldown scope, whether output was committed, and attempted-account count. Exact bindings, non-replayable output and the shared physical-send budget must still stop rotation. No sibling-account quota probe or credential/config change was made here.scy7796 commentedon Oct 21, 2026
Opened #7471 for the Command Code path distinction requested here.
Command Code reports exhausted credits as HTTP 400 (
success: false,error.code: "BAD_REQUEST", message prefixYou have insufficient credits to make this request.). The PR normalizes only that exact refusal to 429, preserves the original body and upstream status in headers, and lets the existingrotateGenericOAuthAccountOn429path rotate to a sibling account. No new retry loop.Local two-account check on 2.88.0: the first account returned the exact 400 refusal, the next account returned 200 /
completed/OK, and the following turn stayed on the second account with one send. Focused tests: 6 pass / 43 assertions; typecheck and privacy scan pass. Account identifiers, tokens, and request IDs are omitted.lidge-jun commentedon Oct 27, 2026
Verified against current
dev(2b5148b): a combo target backed by a pooled OAuth provider already rotates to another account of the same provider on a 429 before the combo hops to the next provider. Combo children run the ordinary concrete-provider dispatch, and its account recovery runs before combo failure handling sees the error.src/server/responses/adapter-dispatch.ts429 loop selects an eligible sibling, applies its full credential snapshot and resends; Antigravity also filters siblings by model rostertests/oauth/oauth-account-attribution.test.ts,tests/oauth/generic-oauth-combo-account-cooldown.test.ts(sends A, A, B before any provider fallback),tests/server/server-google-antigravity-oauth-429-budget.test.tstests/providers/kiro/kiro-refusal-failover.test.tstests/adapters/anthropic/anthropic-sidecar-account-failover.test.ts,anthropic-combo-account-cooldown.test.tstests/server/server-auth.test.tsRecovery stays bounded on purpose: one request funds at most six account attempts, and Codex makes one alternate move under its fixed-selector and uploaded-file guards. A request can therefore still hop after a bounded number of exhausted accounts while a later sibling is healthy. That later sibling stays eligible for the next request because account exhaustion cools only the failing combo target, which #7625 keeps target-scoped.
Closing as already implemented. If you still see an immediate provider hop on 2.94.x with a healthy sibling account, please open a new report with the request log rows (account labels redacted).