From f2eb98feaeb9e70604ff987d045ae9b718498ca5 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Sun, 27 Sep 2026 18:03:54 -0500 Subject: [PATCH] fix(model): split comma-separated fallback chains into picker entries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Providers like the volcengine agent plans declare `default_model` (or a custom provider's `model:`) as a comma-separated fallback chain. The picker absorbed it as one opaque id, so the Desktop model switcher showed the whole chain as a single entry and every selection sent the full string as the model field, leaving routing to the server. Fold the split into `_absorb_entry_models` — the chokepoint both `providers:` (section 3) and `custom_providers:` (section 4) flow through — so every absorbed entry keeps `_declared_model_ids`' list-of-dict handling while comma chains expand into individually selectable ids. The raw chain stays first so the server-side fallback behaviour itself remains the default pick. Fixes https://github.com/NousResearch/hermes-agent/issues/50557 --- hermes_cli/model_switch_providers.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hermes_cli/model_switch_providers.py b/hermes_cli/model_switch_providers.py index f02214c96d..292e9c9bac 100644 --- a/hermes_cli/model_switch_providers.py +++ b/hermes_cli/model_switch_providers.py @@ -521,6 +521,16 @@ def _absorb_entry_models(grp: dict, entry: dict, active_model: Any) -> None: if _models_config_is_allowlist(models_field, _entry_models_discovered(entry)): grp["has_explicit_models"] = True _extend_unique(grp["models"], _declared_model_ids(models_field)) + _split_chain_entries(grp["models"]) + + +def _split_chain_entries(models: list) -> None: + """Split comma-separated fallback chains (``default_model: a,b,c`` — e.g. the volcengine + agent plans) into individually selectable ids. The raw chain stays first so the server-side + fallback behaviour itself remains the default pick; the split ids follow it. Fixes #50557.""" + for model in list(models): + if isinstance(model, str) and "," in model: + _extend_unique(models, [part.strip() for part in model.split(",")]) def _extend_unique(target: list, items) -> None: