fix(acp): pass configured fallback chain to AIAgent — model failover was broken over ACP - #57418
Closed
5uck1ess wants to merge 1 commit into
Closed
fix(acp): pass configured fallback chain to AIAgent — model failover was broken over ACP#574185uck1ess wants to merge 1 commit into
5uck1ess wants to merge 1 commit into
Conversation
The CLI (cli.py: get_fallback_chain) and gateway both hand the configured fallback chain to AIAgent, but the ACP adapter's _make_agent never did. ACP agents therefore ran with an empty _fallback_chain, so a rate-limited, overloaded, or unreachable primary provider stalled the turn in the retry loop (60s+ waits) instead of failing over — model failover was silently broken in every editor/ACP integration. Load the chain with hermes_cli.fallback_config.get_fallback_chain (same helper the CLI uses; merges fallback_providers with legacy fallback_model entries) and pass it as fallback_model when non-empty. Repro: configure fallback_providers, connect via ACP (Zed/Obsidian/etc.), make the primary 429 — before: 'Retrying API call in 60.0s'; after: 'Rate limited — switching to fallback provider...' Claude-Session: https://claude.ai/code/session_01YNvCUipheR7yx4VorUL2jW
Collaborator
Duplicate of #18460 (earliest open PR fixing #18452 with the same |
Author
This was referenced Jul 29, 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.
Fixes #18452.
Problem
The CLI (
cli.pyviaget_fallback_chain) and the gateway both pass the configured fallback chain toAIAgent(fallback_model=...). The ACP adapter's_make_agentnever did — its kwargs dict has nofallback_modelkey — so every ACP agent runs with_fallback_chain = [].Consequence: when the primary provider rate-limits (429), overloads, or drops, the conversation-loop's eager-failover path (
conversation_loop.py, the_should_fallbackblock) finds an empty chain and falls through to the retry loop instead — the turn stalls for 60s+ per retry. Model failover is silently broken in every editor/ACP integration (Zed, Obsidian, VS Code, JetBrains…), exactly as #18452 reports.Hit this in production driving hermes as a voice-assistant brain over ACP: a Cerebras 429 froze the spoken turn in
Retrying API call in 60.0s (attempt 1/3)despite a configured NVIDIA fallback.Fix
Load the chain in
_make_agentwithhermes_cli.fallback_config.get_fallback_chain(config)— the same helper the CLI uses, sofallback_providersand legacyfallback_modelentries both work — and pass it asfallback_modelwhen non-empty. Guarded by try/except mirroring the surrounding provider-resolution style.Verification
tests/acp/test_session.py: the chain reachesAIAgentkwargs when configured; the key is absent when not. Full file: 47 passed.Retrying API call in 60.0s; after —⚠️ Rate limited — switching to fallback provider...and the turn completes on the fallback model.https://claude.ai/code/session_01YNvCUipheR7yx4VorUL2jW