mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
fix(tui-gateway): scope verification and MCP discovery to active profile
This commit is contained in:
parent
c6e811e48f
commit
a7bb123b4a
3 changed files with 17 additions and 12 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue