Skip to content

The agent that grows with you

test(dashboard): /api/ws probe carries an app.state like a real WebSocket

teknium10377e227b5a6
diff --git a/tests/hermes_cli/test_serve_mcp_discovery_after_bind.py b/tests/hermes_cli/test_serve_mcp_discovery_after_bind.py
index 4e319427f37..a80cec9c50e 100644
--- a/tests/hermes_cli/test_serve_mcp_discovery_after_bind.py
+++ b/tests/hermes_cli/test_serve_mcp_discovery_after_bind.py
@@ -128,8 +128,10 @@ def test_first_gateway_ws_client_starts_the_armed_discovery_once(monkeypatch):
monkeypatch.setattr(chat_ws, "_close_unless_sidecar_allowed", _allowed)
monkeypatch.setattr("tui_gateway.ws.handle_ws", _handle_ws)
- asyncio.run(chat_ws.gateway_ws(object()))
- asyncio.run(chat_ws.gateway_ws(object()))
+ # The handler reads the app's session authority off the socket, as a real WebSocket carries it.
+ ws = types.SimpleNamespace(app=types.SimpleNamespace(state=types.SimpleNamespace()))
+ asyncio.run(chat_ws.gateway_ws(ws))
+ asyncio.run(chat_ws.gateway_ws(ws))
assert calls == ["dashboard-mcp-discovery"]
assert mcp_startup._mcp_discovery_deferred is None