From 2c814d7b5d76b91e5884a56341d6d6a248480648 Mon Sep 17 00:00:00 2001 From: donrhmexe Date: Mon, 6 Apr 2026 15:19:12 +0200 Subject: [PATCH] fix: /model --global writes model.name instead of model.default The canonical config key for model name is model.default (used by setup, auth, runtime_provider, profile list, and CLI startup). But /model --global wrote to model.name in both gateway and CLI paths. This caused: - hermes profile list showing the old model (reads model.default) - Gateway restart reverting to the old model (_resolve_gateway_model reads model.default) - CLI startup using the old model (main.py reads model.default) The only reason it appeared to work in Telegram was the cached agent staying alive with the in-place switch. Fix: change all 3 write/read sites to use model.default. --- cli.py | 2 +- gateway/run.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cli.py b/cli.py index c5278d3c2..ff097532c 100644 --- a/cli.py +++ b/cli.py @@ -3721,7 +3721,7 @@ class HermesCLI: # Persistence if persist_global: - save_config_value("model.name", result.new_model) + save_config_value("model.default", result.new_model) if result.provider_changed: save_config_value("model.provider", result.target_provider) _cprint(" Saved to config.yaml (--global)") diff --git a/gateway/run.py b/gateway/run.py index c50c67462..ca1e48946 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -3493,7 +3493,7 @@ class GatewayRunner: cfg = yaml.safe_load(f) or {} model_cfg = cfg.get("model", {}) if isinstance(model_cfg, dict): - current_model = model_cfg.get("name", "") + current_model = model_cfg.get("default", "") current_provider = model_cfg.get("provider", current_provider) current_base_url = model_cfg.get("base_url", "") user_provs = cfg.get("providers") @@ -3603,7 +3603,7 @@ class GatewayRunner: else: cfg = {} model_cfg = cfg.setdefault("model", {}) - model_cfg["name"] = result.new_model + model_cfg["default"] = result.new_model model_cfg["provider"] = result.target_provider if result.base_url: model_cfg["base_url"] = result.base_url