fix(classifier): recognize Anthropic 'out of extra usage' as billing error#13170
Open
jack4git wants to merge 1 commit into
Open
fix(classifier): recognize Anthropic 'out of extra usage' as billing error#13170jack4git wants to merge 1 commit into
jack4git wants to merge 1 commit into
Conversation
…error As of 2026-04-04, Anthropic's third-party-tool enforcement returns HTTP 400 with the error body "You're out of extra usage. Add more at claude.ai/settings/usage and keep going." when a subscription-OAuth call is classified as third-party. This string was not matched by _BILLING_PATTERNS, so classify_api_error returned format_error (retryable=False, should_rotate_credential=False) instead of billing (retryable=False, should_rotate_credential=True, should_fallback=True). The downstream effect: cron sessions hitting the cap could still fall back (format_error also sets should_fallback), but without credential rotation semantics or a clean 'billing' signal for metrics/telemetry. Adding 'out of extra usage' to _BILLING_PATTERNS makes the existing billing-error recovery path engage on the new failure mode. Adds one regression test against a MockAPIError(status=400, body=...). 104 tests passing (up from 103).
Collaborator
|
Likely duplicate of #11736 — same fix: adding 'out of extra usage' to _BILLING_PATTERNS in agent/error_classifier.py. |
This was referenced Apr 24, 2026
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
"out of extra usage"to_BILLING_PATTERNSinagent/error_classifier.pyWhy
Anthropic's 2026-04-04 third-party-tool enforcement surfaces as HTTP 400 with body:
That string wasn't matched by
_BILLING_PATTERNS, soclassify_api_errorreturnedformat_error(retryable=False,should_rotate_credential=False) instead ofbilling(retryable=False,should_rotate_credential=True,should_fallback=True).Observed downstream: cron sessions hitting the cap could still fall back (because
format_erroralso setsshould_fallback=True), but without credential-rotation semantics or a clean "billing" signal for metrics/telemetry.Test plan
test_anthropic_out_of_extra_usage_is_billing— expectsreason=billing,should_fallback=True,should_rotate_credential=Truetests/agent/test_error_classifier.pysuite passes (104/104)