The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(chat): resume accepts the creation `-m <alias>` it was frozen with
Tekniumeb4c78dda96a
diff --git a/hermes_cli/gateway_chat.py b/hermes_cli/gateway_chat.pyindex c23bbe7009d..9599c4c5931 100644--- a/hermes_cli/gateway_chat.py+++ b/hermes_cli/gateway_chat.py@@ -256,6 +256,13 @@ def check_resume_policy(args, snapshot):frozen = dict((info or {}).get("launch_request") or {})if info and "cwd" in info:frozen["cwd"] = info["cwd"]+ if "model" in requested and requested["model"] != frozen.get("model"):+ # The owner froze the resolved id of a `-m <alias>`; the same alias again is the same route.+ from gateway.session_local_route import resolve_launch_route+ from hermes_cli.config_effective import load_user_config_effective+ from hermes_constants import get_hermes_home+ flags = {key: requested[key] for key in ("model", "provider", "base_url", "api_key") if key in requested}+ requested["model"] = resolve_launch_route(flags, load_user_config_effective(get_hermes_home() / "config.yaml"))["model"]for key, value in requested.items():if key == "api_key":continue # never durable; a repeated key is not a policy changediff --git a/tests/hermes_cli/test_resume_alias_model.py b/tests/hermes_cli/test_resume_alias_model.pynew file mode 100644index 00000000000..98f3ac79e0e--- /dev/null+++ b/tests/hermes_cli/test_resume_alias_model.py@@ -0,0 +1,21 @@+"""Repeating the creation `-m <alias>` on resume is the same frozen route, not an override."""+import argparse++import pytest+++def test_resume_accepts_the_creation_alias_and_still_refuses_another_model(tmp_path, monkeypatch):+ from hermes_cli import gateway_chat, model_switch+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))+ (tmp_path / "config.yaml").write_text(+ "model:\n provider: custom\n base_url: http://127.0.0.1:1/v1\n default: model-main\n"+ "model_aliases:\n fast: {model: model-alias, provider: custom, base_url: http://127.0.0.1:3/v1}\n",+ encoding="utf-8")+ model_switch.DIRECT_ALIASES.clear()+ frozen = {"info": {"launch_request": {"source": "cli", "model": "model-alias", "provider": "custom",+ "base_url": "http://127.0.0.1:3/v1"}}}+ gateway_chat.check_resume_policy(argparse.Namespace(resume="s", model="fast", query="x"), frozen)+ gateway_chat.check_resume_policy(argparse.Namespace(resume="s", model="model-alias", query="x"), frozen)+ for model in ("model-main", "other"):+ with pytest.raises(gateway_chat.GatewayClientError):+ gateway_chat.check_resume_policy(argparse.Namespace(resume="s", model=model, query="x"), frozen)