镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

fix(combos): hop past Anthropic's extra-usage refusal - #8588

Draft
vadymhimself wants to merge 2 commits into
lidge-jun:devfrom
vadymhimself:fix/anthropic-extra-usage-hop
Draft

vadymhimself wants to merge 2 commits into
lidge-jun:devfrom
vadymhimself:fix/anthropic-extra-usage-hop

Conversation

@vadymhimself

@vadymhimself vadymhimself commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

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 the src/ 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 scope
    • link-ocx-child-e2e ×2
    • retained sync and serve-options
  • bun run typecheck, bun run structure:check and bun run privacy:scan all pass.
  • I updated structure/runtime.md to match.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

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.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Combo routing now moves to the next option for recognized Anthropic extra-usage refusals in supported plain-text and structured error responses. The cooldown applies only to the affected target. Other error types, quoted messages, and unsupported coded variants remain terminal.
  • Documentation
    • Runtime guidance now describes the supported refusal messages, the error details required for failover, target-specific cooldown behavior, and cases that remain terminal.

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>
@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added bug Something isn't working review-ready labels Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (0/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 0/4).

Review readiness checklist

  • ⬜ 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.

0/4 boxes ticked.

This PR stays in draft until every box above is ticked.

Hygiene

✅ Deterministic PR hygiene checks passed.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds recognition for specific Anthropic extra-usage refusals and uses matching HTTP 400 responses to trigger combo failover. Tests cover accepted and terminal response variants. Runtime documentation describes the refusal patterns and handling.

Changes: Anthropic extra-usage failover

Layer / File(s) Summary
Refusal classification
src/providers/anthropic-billing-refusal.ts
The classifier recognizes exact extra-usage refusal messages and checks the HTTP status, code, and response format. A shared helper normalizes provider-prefixed messages.
Combo failover and validation
src/combos/failover.ts, tests/routing/router-anthropic-billing-failover.test.ts, structure/runtime.md
Combo failure handling hops when the classifier matches. Tests cover accepted and terminal variants. Runtime documentation describes the refusal patterns and handling.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • lidge-jun/opencodex#7965 — The change treats a matching Anthropic extra-usage refusal as a target-scoped hop, but does not add the requested combo_exhausted diagnostic.
  • lidge-jun/opencodex#8288 — The change recognizes the reported Anthropic OAuth refusal wording, but does not address the issue’s instruction-placement cause.
Merge Risk: Minimal · up to e1549

This change lets a combo move to its next tier when Anthropic refuses a request because the extra-usage balance is empty. Quoted, coded or other-typed variants still stop the combo as before. No concrete risk was found that should block merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(combos): hop past Anthropic's extra-usage refusal" names the main change. The changeset adds isAnthropicExtraUsageFailure, wires it into decideComboFailure in src/combos/failover.ts so …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(combos): hop past Anthropic's extra-usage refusal" names the main change. The changeset adds isAnthropicExtraUsageFailure, wires it into decideComboFailure in src/combos/failover.ts so a matching status returns "hop", and adds tests and docs for the Anthropic extra-usage refusal. The title is short, single-sentence, and specific, so it passes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 50b8716 and e1549c4.

Files selected for processing: 1

  • src/combos/failover.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@github-actions
github-actions Bot marked this pull request as draft November 13, 2026 01:01

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant