fix(tui): start MCP discovery for websocket sessions - #38301
Closed
sweetcornna wants to merge 1 commit into
Closed
Conversation
sweetcornna
force-pushed
the
codex/fix-37589-desktop-mcp-discovery
branch
from
June 4, 2026 15:27
e82e8bb to
12321fb
Compare
Contributor
|
Merged via #54161 (commit 5c2c85c on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gateway.readyRoot cause
The stdio TUI path started MCP discovery inside
tui_gateway.entry.main(), but Desktop/dashboard WebSocket sessions enter throughtui_gateway.ws.handle_ws()and never execute that startup path._make_agent()also waited ontui_gateway.entry.wait_for_mcp_discovery(), so WebSocket-created agents had no discovery thread to wait for before snapshotting tools. Manual/reload-mcpworked because it explicitly re-ran discovery and refreshed the session's tool list.Scope
This addresses the Desktop/WebSocket startup-discovery half of #37589 and the duplicate report #38271. It intentionally does not include the separate
uvx/GUI PATH fallback from #37589; that should be a smaller follow-up if still needed.Validation
.venv\\Scripts\\python.exe -m pytest tests/tui_gateway/test_mcp_discovery_startup.py tests/tui_gateway/test_wait_for_mcp_discovery.py tests/test_tui_gateway_server.py::test_make_agent_waits_for_shared_mcp_discovery_before_tool_snapshot tests/hermes_cli/test_mcp_startup.py -q --timeout-method=thread->10 passed.venv\\Scripts\\python.exe -m ruff check tui_gateway/entry.py tui_gateway/server.py tui_gateway/ws.py tests/tui_gateway/test_mcp_discovery_startup.py tests/tui_gateway/test_wait_for_mcp_discovery.py tests/test_tui_gateway_server.py->All checks passed!.venv\\Scripts\\python.exe -m py_compile tui_gateway/entry.py tui_gateway/server.py tui_gateway/ws.py hermes_cli/mcp_startup.py-> passedgit diff --check-> passedAddresses #37589
Addresses #38271