diff --git a/tests/agent/test_codex_app_server_integration.py b/tests/agent/test_codex_app_server_integration.py index 7b89fa48c3..b0b1277c12 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.called def 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 instead of 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 None with 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.py index 63aa67cbfd..9d708cb70b 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.py index dd3032d00f..cee9319047 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 None with contextlib.suppress(Exception): from tools.terminal_tool import register_task_env_overrides