Skip to content

The agent that grows with you

test(tui): pin approval-mode fixtures to env HERMES_HOME for canonical resolver

teknium1c5d37bb95cf7
diff --git a/tests/test_tui_gateway_server.py b/tests/test_tui_gateway_server.py
index dfc44447ccb..7456f116bcd 100644
--- a/tests/test_tui_gateway_server.py
+++ b/tests/test_tui_gateway_server.py
@@ -5313,6 +5313,10 @@ def test_config_get_approval_mode_uses_smart_default_when_key_is_missing(
import yaml
monkeypatch.setattr(server, "_hermes_home", tmp_path)
+ # Point the canonical resolver (load_config → env HERMES_HOME) at the
+ # temp home too, so the smart default is asserted against THIS config
+ # rather than whatever the developer's real ~/.hermes happens to hold.
+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))
(tmp_path / "config.yaml").write_text(
yaml.safe_dump({"approvals": {"timeout": 15}})
)
@@ -5329,6 +5333,11 @@ def test_config_get_approval_mode_fails_safe_to_manual_for_invalid_explicit_valu
import yaml
monkeypatch.setattr(server, "_hermes_home", tmp_path)
+ # _load_approval_mode delegates to the canonical resolver in
+ # tools.approval, which reads via hermes_cli.config.load_config —
+ # that path resolves HERMES_HOME from the environment, not
+ # server._hermes_home.
+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))
(tmp_path / "config.yaml").write_text(
yaml.safe_dump({"approvals": {"mode": "sometimes"}})
)
@@ -5343,6 +5352,9 @@ def test_config_get_approval_mode_normalizes_yaml_off(tmp_path, monkeypatch):
import yaml
monkeypatch.setattr(server, "_hermes_home", tmp_path)
+ # See fail-safe test above: the canonical resolver reads via
+ # load_config, which resolves HERMES_HOME from the environment.
+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))
(tmp_path / "config.yaml").write_text(
yaml.safe_dump({"approvals": {"mode": False}})
)
@@ -5359,6 +5371,10 @@ def test_config_set_approval_mode_persists_three_way_value_and_emits_live_status
import yaml
monkeypatch.setattr(server, "_hermes_home", tmp_path)
+ # config.set writes via server._hermes_home, but the post-write
+ # session.info emit resolves the effective mode through the canonical
+ # tools.approval resolver (load_config → env HERMES_HOME).
+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))
emitted = []
monkeypatch.setattr(server, "_emit", lambda *args: emitted.append(args))
server._sessions["sid"] = {"agent": object(), "session_key": "profile-session"}