fix(cli): preserve /model choice across turns for custom providers#15605
Merged
Conversation
19 tasks
This was referenced Apr 27, 2026
3 tasks
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.
Salvages PR #14654 onto current main (branch was 93 commits stale).
Summary
_ensure_runtime_credentials()was unconditionally overwriting the user's model selection with the custom_provider's configureddefault_modelon every turn. Running/model my-ollama:qwen2.5would silently revert tollama3.2on the next message.Root cause
The override existed to handle the legitimate case where
hermes chat --model <provider-name>passes the provider name as the model (PR #7828 / #8118). But it fired unconditionally — including after a/modelswitch that already set a valid model.Fix
Only apply the runtime
default_modelwhenself.modelis empty or equals the provider slug. Preserves PR #7828's original case; preserves/modelswitches. 8 lines incli.py.Validation
E2E reproduced in isolated HERMES_HOME with a custom_provider defining
default_model: llama3.2:self.model = 'qwen2.5'(post /model switch)self.model = 'my-ollama'(provider-as-model)self.model = ''(unset)Credit to @Readon (original PR #14654). AUTHOR_MAP entry added.