The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(gateway): drop the follow test that bypassed the merge; move the mode test to agent
kshitijk4poor30463589eb54
diff --git a/agent/coding_context.py b/agent/coding_context.pyindex 15cb3beb23a..84e382f0716 100644--- a/agent/coding_context.py+++ b/agent/coding_context.py@@ -327,7 +327,8 @@ class RuntimeMode:def toolset_selection(self, config: Optional[dict[str, Any]] = None) -> Optional[list[str]]:"""Toolset list (only under ``focus``), or ``None`` to keep the platform default. Callers- apply it only when the user hasn't pinned a selection (``--toolsets``, ``HERMES_TUI_TOOLSETS``)."""+ apply it only when the user hasn't pinned a selection (``--toolsets``, ``HERMES_TUI_TOOLSETS``).+ *config* None lists MCP servers from the user's config."""if self.config_mode != "focus" or self.profile.toolset is None:return Nonereturn _posture_toolsets(config) # the focus decision is this mode's own config_modediff --git a/tests/agent/test_coding_context.py b/tests/agent/test_coding_context.pyindex f6bb02dba40..d1b3b4fbbb5 100644--- a/tests/agent/test_coding_context.py+++ b/tests/agent/test_coding_context.py@@ -244,6 +244,16 @@ class TestRuntimeMode:assert mode.toolset_selection() is Noneassert mode.system_blocks() == []+ def test_resolved_focus_ignores_an_on_disk_auto(self, tmp_path, monkeypatch):+ # The focus decision is the mode's own config_mode, not a re-read of the user's config.+ _git_init(tmp_path)+ home = tmp_path / "home"+ home.mkdir()+ (home / "config.yaml").write_text(json.dumps({"agent": {"coding_context": "auto"}}))+ monkeypatch.setenv("HERMES_HOME", str(home))+ mode = cc.resolve_runtime_mode(platform="cli", cwd=tmp_path, config={"agent": {"coding_context": "focus"}})+ assert mode.toolset_selection() == [cc.CODING_TOOLSET]+diff --git a/tests/gateway/test_session_policy_coding_posture.py b/tests/gateway/test_session_policy_coding_posture.pyindex 78cc92b168f..58fdd122140 100644--- a/tests/gateway/test_session_policy_coding_posture.py+++ b/tests/gateway/test_session_policy_coding_posture.py@@ -1,4 +1,7 @@"""The gateway, not the client, applies the coding posture to a session that did not pick toolsets."""+import json+from types import SimpleNamespace+import pytestFOCUS = {'agent': {'coding_context': 'focus'}, 'platform_toolsets': {'cli': ['terminal'], 'acp': ['terminal']}}@@ -56,12 +59,6 @@ def test_a_project_file_written_mid_session_does_not_switch_toolsets(tmp_path):assert policy.current_toolsets(FOCUS) == ('terminal',)-def test_a_following_session_still_takes_a_profile_change(project):- policy = create({'source': 'cli', 'cwd': str(project), 'follow_profile_config': True}, FOCUS)- off = {**FOCUS, 'agent': {'coding_context': 'off'}}- assert policy.current_toolsets(off) == ('terminal',)--def test_plugin_mcp_servers_stay_in_the_posture(project, monkeypatch):monkeypatch.setattr('hermes_cli.plugins.get_portable_mcp_server_names_nowait', lambda: {'plug'})assert {'coding', 'plug'} <= set(create({'source': 'gui', 'cwd': str(project)}, FOCUS).toolsets)@@ -122,8 +119,6 @@ async def test_session_create_selects_the_posture_for_its_named_folder(project,def test_a_following_session_takes_a_profile_coding_context_change(project, tmp_path, monkeypatch):"""Replay through the real follow merge (``policy.config(authority)``), not a hand-built dict."""- import json- from types import SimpleNamespacehome = tmp_path / 'home'home.mkdir()monkeypatch.setenv('HERMES_HOME', str(home))@@ -134,15 +129,3 @@ def test_a_following_session_takes_a_profile_coding_context_change(project, tmp_assert policy.current_toolsets(policy.config(authority, secrets=False)) == ('coding',)(home / 'config.yaml').write_text(json.dumps({**config, 'agent': {'coding_context': 'off'}}))assert policy.current_toolsets(policy.config(authority, secrets=False)) == ('terminal',)---def test_a_resolved_mode_keeps_its_own_focus_decision(project, tmp_path, monkeypatch):- """A mode resolved from a supplied ``focus`` config ignores the on-disk ``auto``."""- import json- from agent.coding_context import resolve_runtime_mode- home = tmp_path / 'home'- home.mkdir()- (home / 'config.yaml').write_text(json.dumps({'agent': {'coding_context': 'auto'}}))- monkeypatch.setenv('HERMES_HOME', str(home))- mode = resolve_runtime_mode(platform='cli', cwd=project, config={'agent': {'coding_context': 'focus'}})- assert mode.toolset_selection() == ['coding']