Skip to content

The agent that grows with you

fix(tui): a TUI-started gateway no longer inherits the launch-time Kanban board

Teknium5fbf748d58f1
diff --git a/tests/tui_gateway/test_gateway_bootstrap_recover.py b/tests/tui_gateway/test_gateway_bootstrap_recover.py
index 513af8fc791..cf64ee59105 100644
--- a/tests/tui_gateway/test_gateway_bootstrap_recover.py
+++ b/tests/tui_gateway/test_gateway_bootstrap_recover.py
@@ -53,3 +53,24 @@ def test_recover_reensures_only_a_crashed_owner(monkeypatch, tmp_path, record, e
with pytest.raises(RuntimeError, match="absent"):
module.bootstrap(False)
assert calls == []
+
+
+def test_started_daemon_does_not_inherit_the_launch_time_kanban_board(monkeypatch, tmp_path):
+ """`hermes --tui` pins HERMES_KANBAN_BOARD for its own launch; the shared daemon this bootstrap
+ starts (spawn_unmanaged_gateway copies os.environ) must keep the profile's current board."""
+ module = _load_bootstrap()
+ home = (tmp_path / "home").resolve()
+ home.mkdir()
+ monkeypatch.setattr(hermes_constants, "get_hermes_home", lambda: home)
+ monkeypatch.setenv("HERMES_KANBAN_BOARD", "launch-board")
+ seen = []
+
+ def ensure(h, timeout=30, idle_exit=False):
+ import os
+ seen.append(os.environ.get("HERMES_KANBAN_BOARD"))
+ return SimpleNamespace(state="starting", endpoint=None, reason_code="deadline", detail=None)
+
+ monkeypatch.setattr(gateway_runtime, "ensure_gateway_runtime", ensure)
+ with pytest.raises(RuntimeError):
+ module.bootstrap(True)
+ assert seen == [None]
diff --git a/ui-tui/scripts/gateway_bootstrap.py b/ui-tui/scripts/gateway_bootstrap.py
index b6301ee60db..2628e6e6cd7 100644
--- a/ui-tui/scripts/gateway_bootstrap.py
+++ b/ui-tui/scripts/gateway_bootstrap.py
@@ -34,11 +34,14 @@ def bootstrap(start: bool, recover: bool = False) -> dict:
from hermes_cli.gateway_runtime_discovery import connect_private
home = get_hermes_home().resolve()
- # Launch policy travels in session.create, not into daemon-wide defaults.
+ # Launch policy travels in session.create, not into daemon-wide defaults. That includes the
+ # Kanban board `hermes --tui` pins at launch (_pin_kanban_board_env): a daemon started from
+ # here would otherwise resolve every later chat's, Desktop window's and cron job's board to
+ # this terminal's launch-time board instead of the profile's `kanban/current`.
for key in ("HERMES_MODEL", "HERMES_INFERENCE_MODEL", "HERMES_TUI_PROVIDER",
"HERMES_INFERENCE_PROVIDER", "HERMES_TUI_TOOLSETS", "HERMES_TUI_SKILLS",
"HERMES_CWD", "TERMINAL_CWD", "HERMES_YOLO", "HERMES_ACCEPT_HOOKS",
- "HERMES_TUI_CHECKPOINTS", "HERMES_TUI_PASS_SESSION_ID"):
+ "HERMES_TUI_CHECKPOINTS", "HERMES_TUI_PASS_SESSION_ID", "HERMES_KANBAN_BOARD"):
os.environ.pop(key, None)
receipt = (ensure_gateway_runtime(home, timeout=30, idle_exit=True) if start
else discover_gateway_endpoint(home, timeout=5))