fix(tui-gateway): start MCP discovery for websocket sessions - #42794
LionGateOS wants to merge 1 commit into
Conversation
|
Likely duplicate of #38301 — same root cause and the same fix. Consolidating there; flagging for maintainer review. |
|
Thanks for checking. That makes sense — I’m fine with consolidating into #38301 if that is the preferred PR. For reference, this PR was tested with: uv run --extra dev python -m pytest tests/test_tui_gateway_ws.py tests/tui_gateway/test_wait_for_mcp_discovery.py The local result was 7 passed. If useful, the focused WebSocket test coverage from this branch can be compared against #38301 before closing/merging. |
df5e2bf to
7a9f0b5
Compare
|
Fixed via #54161 (commit 5c2c85c on |
Summary
Starts background MCP tool discovery for WebSocket/Desktop gateway sessions before emitting
gateway.ready.Previously,
tui_gateway.entry.main()started MCP discovery for the stdio/TUI path, and_make_agent()briefly waited for that discovery before snapshotting tools. WebSocket/Desktop sessions enter throughtui_gateway.ws.handle_ws()and do not runentry.main(), so MCP discovery could be skipped before the first agent build.This refactors the existing MCP startup logic into
ensure_mcp_discovery_started()and calls it from both:tui_gateway.entry.main()for stdio/TUItui_gateway.ws.handle_ws()for WebSocket/DesktopMotivation
Desktop/Dashboard sessions should discover configured MCP tools the same way TUI sessions do. Without this, MCP tools can be missing from Desktop sessions even when they are configured.
Testing
uv run --extra dev python -m pytest tests/test_tui_gateway_ws.py tests/tui_gateway/test_wait_for_mcp_discovery.py