Repository navigation
fix(combos): hop past Anthropic's extra-usage refusal - #8588
Conversation
Anthropic refuses an OAuth turn that bills against an empty extra-usage
balance with HTTP 400 invalid_request_error ("You're out of extra usage"
or "Third-party apps now draw from your extra usage, not your plan
limits"). comboFailureDecision treated it as a terminal invalid request,
so a combo ended the turn instead of reaching its next tier.
Recognize the exact wording under the credit-balance evidence bar
(invalid_request_error envelope, or exact prose with that structured code)
and grant a target-scoped hop. Quoted, coded and other-typed variants stay
terminal.
Carried from the vadymhimself fork (e987656, 79faf06).
Co-Authored-By: Claude Code <noreply@anthropic.com>
|
✅ Deterministic PR hygiene checks passed. |
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request has been marked Ready for Review. Hygiene✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…usage-hop Co-Authored-By: Claude Code <noreply@anthropic.com>
Ingwannu
left a comment
There was a problem hiding this comment.
Exact-head source follow-up for c0c560a8d62e219a285d397eb2aebf181d11c637.
I reviewed the complete four-file diff. The new helper requires the exact bounded extra-usage wording and invalid_request_error carrier; its Combo check runs before generic invalid-request stop, and the regression asserts a target-scoped hop while preserving coded/other-typed/quoted negatives. Existing current-head fork CI has now been allowed.
Please coordinate with #8649, which independently extends the shared billing predicate and explicitly asserts provider-scoped cooldown for overlapping wording. The two implementations have materially different account/cooldown effects and phrase coverage. Choose and document that contract with the owner before merging the overlap; no duplicate closure or contributor-branch takeover is needed. CI permission here is separate from that integration decision and from approval. No local provider/account call or scan was made.
Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Thanks for flagging #8649. @andrew05060414, the overlap is real, but the contracts differ. My proposed contract here remains a target-scoped hop, with the shared credit-balance predicate unchanged. Both PRs accept the exact short/long “out of extra usage” sentence and either apostrophe; this PR additionally accepts the exact “Third-party apps now draw from your extra usage, not your plan limits” sentence. Here the carrier must be invalid_request_error, with no nested error.code; quoted, decorated, other-typed and coded variants remain terminal. Scope matters beyond the combo: widening isAnthropicBillingRefusal also reaches rotateAnthropicBillingKeyOnResponse and the key-pool credit-balance cooldown, while isAnthropicBillingFailure controls provider-scoped combo cooldown. This PR deliberately does not authorize those broader effects from extra-usage wording alone. The third-party message can depend on the target/request, so it is not sufficient evidence to cool every target on that provider. I recommend retaining the separate predicate and target-scoped contract for both phrases. Please confirm the intended owner contract before either overlapping implementation is merged; this comment is a proposal, not a claim of agreement. Happy to incorporate your coverage with attribution once scope is settled. I will not close or modify your PR. @Ingwannu, integration decision is explicitly pending; the green checks are not being treated as approval. |
…usage hop lidge-jun#8649 was closed in favour of lidge-jun#8588, which keeps the evidence in its own narrow helper, covers the third-party-apps wording too, and keeps the cooldown target-scoped.
# Conflicts: # structure/runtime.md
Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Coordination update for @Ingwannu: @andrew05060414 independently checked the overlapping regression against this PR, agreed with target-scoped cooldown, and closed #8649 in favor of #8588: #8649 (comment). Thanks for the comparison and explicit scope decision. No contributor-branch takeover or code import was needed; their verification is credited in the description. Maintainer approval is still pending. This head only merges newer dev; the behavior and negative controls are unchanged. |
|
CI note on head |
|
Maintainer integration into
Thanks @vadymhimself. |
Summary
invalid_request_error. The message is either "You're out of extra usage. Add more at claude.ai/settings/usage and keep going." or the newer "Third-party apps now draw from your extra usage, not your plan limits. Add more at claude.ai/settings/usage and keep going." Public reports: [BUG] CLI completely blocked by "out of extra usage" error despite Max 20x plan at only 10% usage anthropics/claude-code#45020, Anthropic OAuth (Claude Pro/Max subscription) hits "You're out of extra usage" on every real request — routes through pay-per-token endpoint instead of subscription quota NousResearch/hermes-agent#65564 and #79760, and fix: Claude OAuth proxied requests rejected as third-party extra usage (all harnesses) decolua/9router#4353.comboFailureDecisionclassifies that 400 as a terminal invalid request. As a result, a combo such as Claude OAuth → GPT ends the turn instead of moving to its next tier.isAnthropicExtraUsageFailureinsrc/providers/anthropic-billing-refusal.ts. It uses the same evidence bar as the existing credit-balance refusal: aninvalid_request_errorenvelope with the exact wording, or the exact prose together with that structured code. The check runs before the generic invalid-request stop and grants a target-scoped hop.context_length_exceeded), other-typed (api_error) and uncoded bare-prose variants all stay terminal.classifyError. Here it is reworked to follow upstream's exact-envelope pattern (fix(router,combos): hop and cool provider on upstream account quota exhaustion #7625).Verification
All commands used the pinned Bun 1.4.4 with an isolated
HOME.bun test tests/routing/router-anthropic-billing-failover.test.ts: 3 pass, 0 fail. With thesrc/change reverted, the new test fails (2 pass, 1 fail).bun scripts/test.ts --changed=upstream/dev: 43601 pass, 6 fail. All six fail identically without this change:codex-composed-acceptance×2 (fails the same way on the base)connected-client runtime probe scopelink-ocx-child-e2e×2retained sync and serve-optionsbun run typecheck,bun run structure:checkandbun run privacy:scanall pass.structure/runtime.mdto match.Checklist
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.
Summary by CodeRabbit
Latest dev merge validation — 2026-11-14
Merged
upstream/devat873ec9b3b8with a merge commit (no rebase). Pinned Bun 1.4.4, isolated HOME/OPENCODEX_HOME.--changed=upstream/dev: 46,498, 6 known base/environment failures (the same 4 listed above plus WP13 composed acceptance ×2). Affected billing/failover suites: 189 pass, 0 fail. Typecheck, structure:check, and privacy:scan pass. No new runtime changes. Full changed-mode run is not green; the listed exceptions remain disclosed.The 4 common exceptions are retained sync/serve-options, connected-client runtime probe, and compiled Child lifecycle ×2 (
ccexits 69).Integration coordination
andrew05060414 independently checked the overlap, agreed that target-scoped cooldown is the safer contract, and closed #8649 in favor of this PR: #8649 (comment). Credit to them for that comparison and regression check. No code was taken from their branch. The shared credit-balance predicate remains unchanged. This resolves the contributor coordination question; maintainer approval is still required.
🤖 Generated with Claude Code