The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): only a client-named folder can select the coding posture
unsupportedpastels99383e450199
diff --git a/gateway/session_policy.py b/gateway/session_policy.pyindex aee2ff89bb4..11b4b368a09 100644--- a/gateway/session_policy.py+++ b/gateway/session_policy.py@@ -286,7 +286,9 @@ def build_policy(params, config, *, private_secrets=None, profile_terminal=True)# still targets this, and a later profile edit supersedes it.config.setdefault('model', {})['selection_profile'] = list(profile_target(config))_apply_launch_overrides(params, config)- enabled = _resolve_toolsets(params, config, source, safe_mode, cwd)+ # Only a folder the client named is a workspace: the daemon's own directory (the fallback above, used by+ # hosted rooms, Kanban and migrations) must not switch a session into the coding posture.+ enabled = _resolve_toolsets(params, config, source, safe_mode, cwd if 'cwd' in params else None)terminal = build_profile_terminal_scope(get_hermes_home()) if profile_terminal else default_terminal_scope()# The client's launch folder is a path on THIS host: a remote or container backend keeps its own# configured cwd unless the user picked this folder for the session.diff --git a/tests/gateway/test_session_policy_coding_posture.py b/tests/gateway/test_session_policy_coding_posture.pyindex d5cc03ea12a..d1917739890 100644--- a/tests/gateway/test_session_policy_coding_posture.py+++ b/tests/gateway/test_session_policy_coding_posture.py@@ -67,3 +67,11 @@ def test_plugin_mcp_servers_stay_in_the_posture(project, monkeypatch):from gateway.session_policy import build_policymonkeypatch.setattr('hermes_cli.plugins.get_portable_mcp_server_names_nowait', lambda: {'plug'})assert {'coding', 'plug'} <= set(build_policy({'source': 'gui', 'cwd': str(project)}, FOCUS).toolsets)++[email protected]('source', ['tool', 'gui'])+def test_the_daemons_own_directory_is_not_a_workspace(project, monkeypatch, source):+ from gateway.session_policy import build_policy+ monkeypatch.chdir(project)+ monkeypatch.setattr('agent.runtime_cwd.resolve_agent_cwd', lambda: project)+ assert 'coding' not in build_policy({'source': source}, FOCUS, profile_terminal=False).toolsets