Skip to content

fix(cli): preserve /model choice across turns for custom providers#15605

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-5e165703
Apr 25, 2026
Merged

fix(cli): preserve /model choice across turns for custom providers#15605
teknium1 merged 2 commits into
mainfrom
hermes/hermes-5e165703

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

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 configured default_model on every turn. Running /model my-ollama:qwen2.5 would silently revert to llama3.2 on 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 /model switch that already set a valid model.

Fix

Only apply the runtime default_model when self.model is empty or equals the provider slug. Preserves PR #7828's original case; preserves /model switches. 8 lines in cli.py.

Validation

E2E reproduced in isolated HERMES_HOME with a custom_provider defining default_model: llama3.2:

Input Old behavior New behavior
self.model = 'qwen2.5' (post /model switch) → llama3.2 (bug) → qwen2.5 ✓
self.model = 'my-ollama' (provider-as-model) → llama3.2 → llama3.2 ✓
self.model = '' (unset) → llama3.2 → llama3.2 ✓

Credit to @Readon (original PR #14654). AUTHOR_MAP entry added.

@teknium1 teknium1 merged commit df48562 into main Apr 25, 2026
11 of 12 checks passed
@teknium1 teknium1 deleted the hermes/hermes-5e165703 branch April 25, 2026 11:49
@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 Apr 25, 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.

3 participants