fix(tui): pass providers: dict (not list) to switch_model — fixes /model for user-defined providers#18085
Closed
arsaboo wants to merge 1 commit into
Closed
fix(tui): pass providers: dict (not list) to switch_model — fixes /model for user-defined providers#18085arsaboo wants to merge 1 commit into
arsaboo wants to merge 1 commit into
Conversation
…odel_switch
TUI /model failed for user-defined providers (e.g. ollama-local) with
"Unknown provider 'ollama-local'" because _apply_model_switch() was
converting the config.yaml providers: dict into a list of
{"provider": k, **v} dicts. resolve_user_provider() calls
user_config.get(name) which expects a plain dict keyed by provider slug,
so the list format always returned None and provider resolution failed.
Fix _apply_model_switch() to pass the raw dict (matching how the CLI
and web_server already pass it). Also fix the validation-override loop
in switch_model() which was written to iterate the (now-removed) list
format; it now does a direct dict lookup on the target provider key.
Adds two regression tests:
- end-to-end switch_model() call with ollama-local in dict format
- unit proof that the old list shape fails while dict shape succeeds
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
14 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.
Summary
tui_gateway/server.py::_apply_model_switch()was converting theproviders:dict from config.yaml into a list of{"provider": k, **v}dicts before callingswitch_model(). Butresolve_user_provider()inhermes_cli/providers.pycallsuser_config.get(name)— which expects a plain dict keyed by provider slug. The list format always returnedNone, causing the "Unknown provider 'ollama-local'" error.tui_gateway/server.py: Changed the list comprehension tocfg.get("providers") if isinstance(..., dict) else {}— matching how the CLI andweb_server.pyalready pass this value.hermes_cli/model_switch.py: Fixed the validation-override block which was written to iterate the (now-removed) list format. It now does a direct dict key lookup ontarget_providerinstead of looping.Test plan
test_switch_model_resolves_ollama_local_from_providers_dict— end-to-end switch through the corrected dict path; asserts no "Unknown provider" error andtarget_provider == "ollama-local"test_switch_model_list_format_user_providers_fails_to_resolve— unit proof that the old list shape returnsNonewhile the correct dict shape resolves; prevents regression back to the list formattests/hermes_cli/test_user_providers_model_switch.pysuite (27 tests) passes