Skip to content

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

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

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

Conversation

@shellybotmoyer

Copy link
Copy Markdown
Contributor

Summary

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

This PR supersedes #18962 which fell 86 commits behind main and shows DIRTY merge state.

Problem

When the primary provider returns HTTP 429 (rate-limit) in --oneshot mode, the agent hard-fails instead of falling back through the fallback_providers chain. Gateway mode already handles this correctly.

Root Cause

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

Fix (2 lines)

  1. After the existing toolsets_list block, extract fallback config:
    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 list (fallback_providers) and legacy dict (fallback_model) formats, so this works with either config style.

Conflict Resolution

origin/main added session_db = _create_session_db_for_oneshot() and clarify_callback=_oneshot_clarify_callback in the same block as the old PR. This branch is rebased onto current origin/main and inserts the fallback extraction between those two new lines.

Testing

  • hermes_cli/oneshot.py is valid Python (no syntax errors).
  • AIAgent.__init__ already accepts fallback_model (line ~954 in run_agent.py).

Fixes NousResearch#18961.

Two-line change:
1. Extract fallback config from already-loaded cfg:
   fallback_model = cfg.get("fallback_providers") or cfg.get("fallback_model") or None
2. Pass fallback_model=fallback_model to AIAgent(...) constructor (parity with gateway)

The conflict against current main was trivial: origin/main added session_db=...
and clarify_callback=... in the same code block; this change inserts the
fallback_model extraction before session_db and adds the fallback_model= keyword
between credential_pool and the clarify_callback comment block.
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists labels May 11, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This PR supersedes #18962 (same author, rebased onto current main). Also overlaps with #23368 which fixes the same issue.

Related: #18961 (original issue)

@teknium1

Copy link
Copy Markdown
Contributor

Closing as already fixed on main.

Triage notes (high confidence):
origin/main hermes_cli/oneshot.py:30,304-319 already imports get_fallback_chain and passes fallback_model=_fb to AIAgent in oneshot mode.

If you still see this on the latest version, please reopen with reproduction steps.

(Bulk-closed during a CLI triage sweep.)

@teknium1 teknium1 closed this May 24, 2026
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

3 participants