fix(auxiliary): harden fallback behavior for non-OpenRouter users#7594
Closed
kshitijk4poor wants to merge 1 commit intoNousResearch:mainfrom
Closed
fix(auxiliary): harden fallback behavior for non-OpenRouter users#7594kshitijk4poor wants to merge 1 commit intoNousResearch:mainfrom
kshitijk4poor wants to merge 1 commit intoNousResearch:mainfrom
Conversation
This was referenced Apr 11, 2026
e8e9875 to
44d6408
Compare
Four fixes to auxiliary_client.py: 1. Respect explicit provider as hard constraint (NousResearch#7559) When auxiliary.{task}.provider is explicitly set (not 'auto'), connection/payment errors no longer silently fallback to cloud providers. Local-only users (Ollama, vLLM) will no longer get unexpected OpenRouter billing from auxiliary tasks. 2. Eliminate model='default' sentinel (NousResearch#7512) _resolve_api_key_provider() no longer sends literal 'default' as model name to APIs. Providers without a known aux model in _API_KEY_PROVIDER_AUX_MODELS are skipped instead of producing model_not_supported errors. 3. Add payment/connection fallback to async_call_llm (NousResearch#7512) async_call_llm now mirrors sync call_llm's fallback logic for payment (402) and connection errors. Previously, async consumers (session_search, web_tools, vision) got hard failures with no recovery. Also fixes hardcoded 'openrouter' fallback to use the full auto-detection chain. 4. Use accurate error reason in fallback logs (NousResearch#7512) _try_payment_fallback() now accepts a reason parameter and uses it in log messages. Connection timeouts are no longer misleadingly logged as 'payment error'. Closes NousResearch#7559 Closes NousResearch#7512
44d6408 to
0054424
Compare
Contributor
|
Merged via #7647. Your commit was cherry-picked onto current main with your authorship preserved in git log. Thanks @kshitijk4poor! |
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
Four fixes to
auxiliary_client.pyaddressing the most common user pain points for non-OpenRouter providers.Fixes
1. Respect explicit provider as hard constraint (#7559)
When
auxiliary.{task}.provideris explicitly set (notauto), connection/payment errors no longer silently fallback to cloud providers. Local-only users (Ollama, vLLM) will no longer get unexpected OpenRouter billing from auxiliary tasks.Before:
auxiliary.compression.provider: customwith a local model → timeout → falls through togoogle/gemini-3-flash-previewon OpenRouter → unexpected billing.After:
auxiliary.compression.provider: custom→ timeout → error propagates to caller. No cloud API calls made.The fallback chain only activates when
provider: auto(the default).2. Eliminate
model="default"sentinel (#7512 bug 1)_resolve_api_key_provider()no longer returns literal string"default"as the model name for providers not in_API_KEY_PROVIDER_AUX_MODELS. Those providers are now skipped instead of producingmodel_not_supportederrors on every API.3. Add payment/connection fallback to
async_call_llm(#7512 bug 2)async_call_llmnow mirrorscall_llm's fallback logic for 402 (payment) and connection errors. Previously, async consumers (session_search,web_tools,vision_tools) got hard failures with no recovery.Also fixes the hardcoded
"openrouter"fallback inasync_call_llmto use the full auto-detection chain (matching whatcall_llmalready does).4. Accurate error reason in fallback logs (#7512 bug 3)
_try_payment_fallback()now accepts areasonparameter. Connection timeouts are no longer misleadingly logged as"payment error".Tests
TestModelDefaultElimination(2 tests): verify no provider maps to"default"TestIsConnectionError(5 tests): connection refused, timeout, DNS, negativesTestTryPaymentFallbackReason(1 test): reason kwarg accepted90 passed, 3 failed (all pre-existing on upstream/main — JWT expiry test, NameError in vision test, xdist race condition).
Impact
All
call_llm/async_call_llmconsumers handleRuntimeErrorgracefully — none will crash from these changes. The change is backward-compatible:auto(the default) behaves identically to before.Closes #7559
Closes #7512