Repository navigation
fix(combos): one Anthropic account's 402 credit refusal cools the account, not the combo target - #7204
fix(combos): one Anthropic account's 402 credit refusal cools the account, not the combo target#7204vadymhimself wants to merge 3 commits into
Conversation
|
@coderabbitai review |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
✅ Action performedReview finished.
|
|
✅ Deterministic PR hygiene checks passed. |
223b855 to
70b25a3
Compare
… combo target The per-request account budget can end a generic OAuth pool's rotation before it reaches every stored account, so a 429 reaches the combo layer while a sibling is still healthy. The combo then cooled the whole target for that account's Retry-After (up to the 24h server-delay ceiling) and sent traffic to the fallback target, or answered 503. Resolve the refused account from the child's accountLogLabel and hand it to the pool's own rotator, which cools it under the pool's Retry-After policy. The target is spared only when the rotator names an eligible sibling; a lone account or a fully cooled pool still cools the target. Anthropic OAuth and Codex attribution are unchanged. API-key pools need no change: their 429 rotation walks every key inside the attempt. Co-Authored-By: Claude Code <noreply@anthropic.com>
…ount, not the combo target The Anthropic OAuth pool rotates only on 401/403/429, so a 402 carrying the credit-balance refusal reaches the combo with the refused account still selectable. The combo classifies 402 as provider-scoped and cooled every anthropic target in the combo, sending traffic to the fallback (or a zero-attempt 503) while a sibling account still answered. When the failed child identifies one pool account and the failure carries the exact credit-balance wording, record that account's refusal through the pool's own recordAnthropicAccountRefusal (the entitlement backoff a 403 credit refusal already gets) and skip the target cooldown only while the pool still has an eligible account. A lone account, an exhausted pool, an unidentified account and every other 402 keep the provider-scoped cooldown. Co-Authored-By: Claude Code <noreply@anthropic.com>
70b25a3 to
0dadd7f
Compare
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. This pull request was already a draft. Its draft status will be preserved after every issue above is resolved. |
|
Being carried into #7224 with your authorship preserved; this PR will be closed when the bundle lands. |
The combo layer asks the generic OAuth rotator only whether a healthy sibling exists; it never dispatches to the account the rotator names. Under pool.kernel round-robin the rotator committed that pick, advancing the ring and making it sticky to an account no request was sent to. Add a `commit` flag to rotateGenericOAuthAccountOn429 (default true). The combo passes false: the failed account is still cooled, but the ring is only peeked. Co-Authored-By: Claude Code <noreply@anthropic.com>
…evidence fixes (#7191, #7204, #7187, #7209, #7175, #7185, #7193, #7197, #7198) (#7224) Carried from #7191, #7204, #7187, #7209, #7175, #7185, #7193, #7197, #7198 (one commit per source PR, original author preserved). Security review follow-up: the Anthropic 402 combo cooldown now validates the sending credential's ownership before cooling an account. Remote validation (hosted GitHub Actions unreliable; local tests not run by maintainer rule): union candidate codex/prr-integ-8 = dev c03eafd + #7224 + #7223 + #7225 + #7217 + #6454 + #6594 plus a Gentle Shell import-cycle fix (integ-9 e1f289c: typecheck + full suite on mini (Windows) and lidge (Linux), compared with the same host's dev runs) and a test-only Windows path-escaping fix for the reasoning-retention routing test (integ-10 0d4cba7, tree a2b309a: that file re-run on both hosts). Co-authored-by: Vadym O <bolein95@gmail.com>
Summary
fix/combo-pool-account-cooldown-all-pools) because both edit the samefailedAccountblock insrc/server/responses/core-combo.ts. Review or merge fix(combos): a spent generic OAuth account cools the account, not the combo target #7191 first; until then this diff also shows fix(combos): a spent generic OAuth account cools the account, not the combo target #7191's commit.rotateAnthropicAccountOnResponseForInstance, and the dispatch loop that calls it), so a 402 carrying the credit-balance refusal reaches the combo layer with that account still selectable.comboFailureCooldownScopeclassifies 402 as provider-scoped, so everyanthropic/*target in the combo cooled for the full cooldown. Traffic went to the fallback target, or got a zero-attempt 503, while a sibling account still answered. Reproduced on cleandev(60bf4c7) with the new test:isComboTargetInCooldownistrueafter account A's 402, and A has no pool health entry.formatAnthropicProviderForLoglabel match thatcooledPoolAccountLabeluses) and the failure carries the exact credit-balance refusal (isAnthropicBillingFailure, the evidencefailover.tsalready reads),core-combo.tsrecords that account's refusal through the pool's ownrecordAnthropicAccountRefusal. It records it as 403, the entitlement backoff a 403 credit-balance refusal already gets. The combo then names the account only whilegetEligibleAnthropicAccountsis non-empty.resolve.tstreats a named-account 402 like the named-account 429: it records no target cooldown.src/oauth/changes.Verification
bun test tests/adapters/anthropic/anthropic-combo-account-cooldown.test.ts. The new 402 test fails on cleandev60bf4c7 (target cooled) and passes here 5/5 runs. The added exhausted-pool test fails if the sibling-eligibility guard is removed (mutation-checked).bun run typecheck: clean.bun run structure:check: passed.structure/runtime.mddocuments the 402 case next to the fix(combos): a spent generic OAuth account cools the account, not the combo target #7191 text.bun run privacy:scan: passed.bun run test:changed(the core-combo graph covers 1739 files): 38223 pass, 27 fail, 3 errors. Every failure is intests/cli/cli-access-audio-live,cli-connect-readiness,ocx-launcher-runtime,codex-integration/codex-runtime,native-codex-toggle,native-grok-toggle, andtests/service/*. Rerun in isolation, those 9 files give the identical 7 failures on cleandevand on this branch. The rest are load-dependent under the full parallel run. No combo, routing, or Anthropic test fails.bun run testhas not been run locally.Checklist
🤖 Generated with Claude Code
Summary by CodeRabbit
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.