Skip to content

fix(acp): pass configured fallback chain to AIAgent — model failover was broken over ACP - #57418

Closed
5uck1ess wants to merge 1 commit into
NousResearch:mainfrom
5uck1ess:fix/acp-fallback-chain
Closed

fix(acp): pass configured fallback chain to AIAgent — model failover was broken over ACP#57418
5uck1ess wants to merge 1 commit into
NousResearch:mainfrom
5uck1ess:fix/acp-fallback-chain

Conversation

@5uck1ess

@5uck1ess 5uck1ess commented Jul 3, 2026

Copy link
Copy Markdown

Fixes #18452.

Problem

The CLI (cli.py via get_fallback_chain) and the gateway both pass the configured fallback chain to AIAgent(fallback_model=...). The ACP adapter's _make_agent never did — its kwargs dict has no fallback_model key — 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_fallback block) 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_agent with hermes_cli.fallback_config.get_fallback_chain(config) — the same helper the CLI uses, so fallback_providers and legacy fallback_model entries both work — and pass it as fallback_model when non-empty. Guarded by try/except mirroring the surrounding provider-resolution style.

Verification

  • Two new tests in tests/acp/test_session.py: the chain reaches AIAgent kwargs when configured; the key is absent when not. Full file: 47 passed.
  • Live before/after on the ACP path: before — 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

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
@alt-glitch alt-glitch added type/bug Something isn't working comp/acp Agent Communication Protocol adapter P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Jul 3, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #18460 (earliest open PR fixing #18452 with the same fallback_model kwarg in acp_adapter/session.py). Saturated cluster — also open: #22200, #36720. Same code site and mechanism; keeping #18460 as canonical. A maintainer should pick one and close the rest.

@5uck1ess

5uck1ess commented Jul 3, 2026

Copy link
Copy Markdown
Author

Closing as duplicate — #18460 is the earliest open fix for #18452 (same call site, has tests). Deferring to it as canonical per triage. One observation left on #18460 re: merging fallback_providers with legacy fallback_model rather than or-ing them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/acp Agent Communication Protocol adapter duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACP adapter does not pass fallback_providers to AIAgent — model failover broken in editor integrations

2 participants