Skip to content

fix(cli): propagate fallback_providers to AIAgent in oneshot mode#18962

Closed
shellybotmoyer wants to merge 1 commit into
NousResearch:mainfrom
shellybotmoyer:fix/oneshot-fallback-providers
Closed

fix(cli): propagate fallback_providers to AIAgent in oneshot mode#18962
shellybotmoyer wants to merge 1 commit into
NousResearch:mainfrom
shellybotmoyer:fix/oneshot-fallback-providers

Conversation

@shellybotmoyer

Copy link
Copy Markdown
Contributor

Summary

Fixes #18961--oneshot CLI mode now respects the configured fallback_providers chain from config.yaml, bringing it to parity with gateway mode.

Problem

When the primary provider returns HTTP 429 (rate-limit) in --oneshot mode, the agent hard-fails instead of falling back to the next provider in the fallback_providers chain. Gateway mode already handles this correctly by passing fallback_model=self._fallback_model to the AIAgent() constructor.

Root Cause

hermes_cli/oneshot.py loads cfg = load_config() but never extracts fallback_providers / fallback_model from it, and the AIAgent(...) call at line 287 is missing the fallback_model= parameter entirely.

Fix

Two-line change:

  1. Extract fallback config from the already-loaded cfg: fallback_model = cfg.get("fallback_providers") or cfg.get("fallback_model") or None
  2. Pass it to AIAgent(...): fallback_model=fallback_model

AIAgent.__init__ already normalizes both the list (fallback_providers) and legacy dict (fallback_model) formats into a fallback chain, so this works with either config style.

Testing

  • Manual: configure a fallback_providers chain in config.yaml, then run hermes --oneshot while the primary provider is rate-limited → previously hard-failed, now falls back.
  • AIAgent.__init__ signature already accepts fallback_model parameter (line 954 in run_agent.py), so no downstream changes needed.

Files Changed

  • hermes_cli/oneshot.py: Added fallback config extraction + parameter passthrough (5 lines)

Oneshot CLI mode was missing the fallback_model parameter that gateway mode already passes to AIAgent(). When the primary provider returns 429, oneshot would hard-fail instead of falling back to the next provider in the chain.

Fixes NousResearch#18961
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels May 2, 2026
@shellybotmoyer

Copy link
Copy Markdown
Contributor Author

Superseded by #23683 — rebased onto current main to resolve the DIRTY merge state.

@shellybotmoyer

Copy link
Copy Markdown
Contributor Author

Superseded by #23683. This branch has merge conflicts; the fix was rebased cleanly in #23683.

@shellybotmoyer

Copy link
Copy Markdown
Contributor Author

Closing in favor of #23683 which has clean merge state.

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

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--oneshot CLI mode: fallback_providers chain not propagated to AIAgent constructor

2 participants