diff --git a/tests/test_tui_gateway_server.py b/tests/test_tui_gateway_server.py index dfbe62f2808..efc0b180f8a 100644 --- a/tests/test_tui_gateway_server.py +++ b/tests/test_tui_gateway_server.py @@ -94,6 +94,7 @@ def test_session_context_uses_session_cwd(monkeypatch, tmp_path): session_key = "cwd-key" project = tmp_path / "project" project.mkdir() + (project / ".git").mkdir() launcher = tmp_path / "apps" / "desktop" launcher.mkdir(parents=True) @@ -10787,12 +10788,14 @@ def test_session_most_recent_handles_db_unavailable(monkeypatch): # ── verification.status ────────────────────────────────────────────── -def test_verification_status_returns_recorded_evidence(tmp_path): - home = tmp_path / ".hermes" - home.mkdir() - token = set_hermes_home_override(home) +def test_verification_status_returns_recorded_evidence(tmp_path, monkeypatch): + profile_home = tmp_path / "profiles" / "verify" + profile_home.mkdir(parents=True) + monkeypatch.setattr(server, "_profile_home", lambda p: profile_home if p == "verify" else None) + token = set_hermes_home_override(profile_home) project = tmp_path / "project" project.mkdir() + (project / ".git").mkdir() (project / "package.json").write_text( json.dumps({"scripts": {"test": "vitest"}}), encoding="utf-8", @@ -10813,7 +10816,7 @@ def test_verification_status_returns_recorded_evidence(tmp_path): { "id": "1", "method": "verification.status", - "params": {"cwd": str(project), "session_id": "sid"}, + "params": {"cwd": str(project), "session_id": "sid", "profile": "verify"}, } ) finally: diff --git a/tests/test_tui_gateway_ws.py b/tests/test_tui_gateway_ws.py index 7c6c82dc9b2..da3c9be3446 100644 --- a/tests/test_tui_gateway_ws.py +++ b/tests/test_tui_gateway_ws.py @@ -9,13 +9,14 @@ from tui_gateway import server from tui_gateway import ws as ws_mod -def test_ws_startup_starts_background_mcp_discovery(monkeypatch): - """The desktop app and dashboard chat reach the agent through this WS - sidecar, not through tui_gateway.entry.main() (which spawns the discovery - thread for the stdio TUI). handle_ws must start discovery itself, otherwise - _make_agent's wait_for_mcp_discovery no-ops and the agent snapshots an - MCP-less tool list. Regression test for #38945.""" +def test_ws_does_not_own_mcp_discovery_startup(monkeypatch): + """WebSocket transport must not start MCP discovery itself. + + MCP discovery ownership belongs to the profile-scoped agent build path. + The WS layer only establishes the transport and emits gateway readiness. + """ calls = [] + monkeypatch.setattr( mcp_startup, "start_background_mcp_discovery", @@ -41,7 +42,7 @@ def test_ws_startup_starts_background_mcp_discovery(monkeypatch): finally: server._sessions.clear() - assert calls == [{"logger": ws_mod._log, "thread_name": "tui-ws-mcp-discovery"}] + assert calls == [] def _run_disconnect(monkeypatch, seed): diff --git a/tui_gateway/server.py b/tui_gateway/server.py index 7bddf0bc82c..0d769f34343 100644 --- a/tui_gateway/server.py +++ b/tui_gateway/server.py @@ -7057,6 +7057,7 @@ def _(rid, params: dict) -> dict: @method("verification.status") +@_profile_scoped def _(rid, params: dict) -> dict: """Best known coding verification evidence for a cwd/session.