fix(cli): propagate fallback_providers to AIAgent in oneshot mode#18962
Closed
shellybotmoyer wants to merge 1 commit into
Closed
fix(cli): propagate fallback_providers to AIAgent in oneshot mode#18962shellybotmoyer wants to merge 1 commit into
shellybotmoyer wants to merge 1 commit into
Conversation
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
4 tasks
Contributor
Author
|
Superseded by #23683 — rebased onto current main to resolve the DIRTY merge state. |
Contributor
Author
Contributor
Author
|
Closing in favor of #23683 which has clean merge state. |
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
Fixes #18961 —
--oneshotCLI mode now respects the configuredfallback_providerschain fromconfig.yaml, bringing it to parity with gateway mode.Problem
When the primary provider returns HTTP 429 (rate-limit) in
--oneshotmode, the agent hard-fails instead of falling back to the next provider in thefallback_providerschain. Gateway mode already handles this correctly by passingfallback_model=self._fallback_modelto theAIAgent()constructor.Root Cause
hermes_cli/oneshot.pyloadscfg = load_config()but never extractsfallback_providers/fallback_modelfrom it, and theAIAgent(...)call at line 287 is missing thefallback_model=parameter entirely.Fix
Two-line change:
cfg:fallback_model = cfg.get("fallback_providers") or cfg.get("fallback_model") or NoneAIAgent(...):fallback_model=fallback_modelAIAgent.__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
fallback_providerschain inconfig.yaml, then runhermes --oneshotwhile the primary provider is rate-limited → previously hard-failed, now falls back.AIAgent.__init__signature already acceptsfallback_modelparameter (line 954 inrun_agent.py), so no downstream changes needed.Files Changed
hermes_cli/oneshot.py: Added fallback config extraction + parameter passthrough (5 lines)