The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tui): tolerate agents without session_cwd in _register_session_cwd; adapt stubs to the cwd kwarg
teknium1c2e5c94cd765
diff --git a/tests/agent/test_codex_app_server_integration.py b/tests/agent/test_codex_app_server_integration.pyindex 7b89fa48c39..b0b1277c12d 100644--- a/tests/agent/test_codex_app_server_integration.py+++ b/tests/agent/test_codex_app_server_integration.py@@ -346,7 +346,7 @@ class TestRunConversationCodexPath:assert not client_mock.chat.completions.create.calleddef test_gateway_terminal_cwd_seeds_codex_thread_cwd(self, monkeypatch, tmp_path):- """Gateway sessions set TERMINAL_CWD without stamping agent.session_cwd.+ """Gateway sessions set TERMINAL_CWD without pinning agent.session_cwd.Codex app-server must still start in that configured workspace insteadof falling back to the Hermes daemon process cwd."""from agent.transports.codex_app_server_session import (@@ -372,7 +372,7 @@ class TestRunConversationCodexPath:monkeypatch.setattr(CodexAppServerSession, "run_turn", fake_run_turn)agent = _make_codex_agent()- assert not hasattr(agent, "session_cwd")+ assert agent.session_cwd is Nonewith patch.object(agent, "_spawn_background_review", return_value=None):agent.run_conversation("hi")diff --git a/tests/tui_gateway/test_session_db_ownership_teardown.py b/tests/tui_gateway/test_session_db_ownership_teardown.pyindex 63aa67cbfd4..9d708cb70bc 100644--- a/tests/tui_gateway/test_session_db_ownership_teardown.py+++ b/tests/tui_gateway/test_session_db_ownership_teardown.py@@ -274,7 +274,7 @@ def build_env(monkeypatch, tmp_path):monkeypatch.setattr("hermes_state_registry.acquire", _factory)for name, value in [- ("_set_session_context", lambda _key: []),+ ("_set_session_context", lambda _key, cwd=None: []),("_clear_session_context", lambda _tokens: None),("_wire_callbacks", lambda _sid: None),("_config_model_target", lambda: None),diff --git a/tui_gateway/session_workdir.py b/tui_gateway/session_workdir.pyindex dd3032d00f0..cee9319047b 100644--- a/tui_gateway/session_workdir.py+++ b/tui_gateway/session_workdir.py@@ -197,7 +197,7 @@ def _register_session_cwd(session: dict | None) -> None:return# Workspace moves must reach lazy/restarted runtimes, not just terminal tools.# Do not reinitialize memory providers or invalidate the cached system prompt.- if (agent := session.get("agent")) is not None:+ if hasattr(agent := session.get("agent"), "session_cwd"):agent.session_cwd = session.get("cwd") or Nonewith contextlib.suppress(Exception):from tools.terminal_tool import register_task_env_overrides