From 2f0a83dd126d66dacc6ccbc88a98a964e443586b Mon Sep 17 00:00:00 2001 From: Yang Zhi Date: Thu, 9 Apr 2026 11:31:41 +0800 Subject: [PATCH] fix(cli): update TUI status bar model name on provider fallback The status bar reads self.model from the CLI class, which is set once at init and never updated when _try_activate_fallback() switches to a backup provider/model in run_agent.py. This causes the TUI to display the original model name while context_length_max changes, creating a confusing mismatch. Read the model name from agent.model (live, updated by fallback) with self.model as fallback before the agent is created. Remove the redundant getattr(self, 'agent') call that was already done above. --- cli.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cli.py b/cli.py index fa32ae9119d..347250e3987 100644 --- a/cli.py +++ b/cli.py @@ -1603,7 +1603,12 @@ class HermesCLI: return f"[{('█' * filled) + ('░' * max(0, width - filled))}]" def _get_status_bar_snapshot(self) -> Dict[str, Any]: - model_name = self.model or "unknown" + # Prefer the agent's model name — it updates on fallback. + # self.model reflects the originally configured model and never + # changes mid-session, so the TUI would show a stale name after + # _try_activate_fallback() switches provider/model. + agent = getattr(self, "agent", None) + model_name = (getattr(agent, "model", None) or self.model or "unknown") model_short = model_name.split("/")[-1] if "/" in model_name else model_name if model_short.endswith(".gguf"): model_short = model_short[:-5] @@ -1629,7 +1634,6 @@ class HermesCLI: "compressions": 0, } - agent = getattr(self, "agent", None) if not agent: return snapshot