fix(run-agent): rotate credential pool on billing-classified 400s - #6940
Closed
helix4u wants to merge 1 commit into
Closed
fix(run-agent): rotate credential pool on billing-classified 400s#6940helix4u wants to merge 1 commit into
helix4u wants to merge 1 commit into
Conversation
helix4u
marked this pull request as ready for review
April 10, 2026 04:09
Contributor
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.
What does this PR do?
Fixes a credential-pool recovery gap where billing-style HTTP 400 errors, such as Anthropic out of extra usage, were correctly classified as rotation-worthy but still aborted instead of rotating to the next credential.
The core issue was that classify_api_error could mark billing-style 400s as should_rotate_credential true, while pool recovery in run_agent.py still only keyed off raw status codes 402, 429, and 401. This PR lets credential-pool recovery honor the classified failover reason, so billing, rate-limit, and auth recovery still work when a provider reports the condition under a different raw status code.
Related Issue
No linked upstream issue yet.
Type of Change
Changes Made
How to Test
Focused automated checks run for this PR:
Observed focused results:
Full suite status from a clean single-process run:
The full-suite failures appear unrelated to this credential-pool fix and are spread across other areas such as CLI defaults, cron scheduler delivery, gateway approvals, Discord bot filtering, browser provider handling, and tirith security tests.
Checklist