fix(auxiliary): fallback on auth errors in auto mode#21190
Open
qWaitCrypto wants to merge 1 commit into
Open
Conversation
This was referenced May 7, 2026
This was referenced May 26, 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.
What does this PR do?
Fixes an auxiliary runtime fallback gap where
401authentication failures did not trigger the auto-provider fallback chain.In
agent/auxiliary_client.py, auxiliary calls already fall back on payment errors, connection errors, and rate limits when the resolved provider isauto. But401auth errors were excluded fromshould_fallback, so auxiliary tasks like compression could fail outright after an auth error instead of trying another provider.This PR adds auth errors to the fallback trigger in both
call_llm()andasync_call_llm(), while preserving the existing execution order:automode fall back to another provider.Note:
_try_payment_fallback()is historical naming. It now handles multiple fallback reasons, but renaming it would be a wider refactor and is intentionally out of scope for this PR.Related Issue
Fixes #21165
Type of Change
Changes Made
_is_auth_error(first_err)to theshould_fallbackcondition in sync auxiliary calls inagent/auxiliary_client.py._is_auth_error(first_err)to theshould_fallbackcondition in async auxiliary calls inagent/auxiliary_client.py.reason = "auth error"logging/dispatch branch for sync and async fallback paths.tests/agent/test_auxiliary_client.pycovering401auth failures inautomode for both sync and async auxiliary calls.How to Test
python3 -m py_compile agent/auxiliary_client.py tests/agent/test_auxiliary_client.py.python3 -m pytest -q tests/agent/test_auxiliary_client.py.401auth-error fallback paths inautomode.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Validation run:
python3 -m py_compile agent/auxiliary_client.py tests/agent/test_auxiliary_client.py python3 -m pytest -q tests/agent/test_auxiliary_client.py # 136 passed