fix(tui): rebuild agent tool schema when background MCP discovery completes (fixes #38945) - #39007
Closed
Morad37 wants to merge 1 commit into
Closed
fix(tui): rebuild agent tool schema when background MCP discovery completes (fixes #38945)#39007Morad37 wants to merge 1 commit into
Morad37 wants to merge 1 commit into
Conversation
…pletes (fixes NousResearch#38945) MCP tool discovery runs in a background daemon thread at TUI/Desktop startup to avoid blocking the shell on slow HTTP MCP servers. The agent snapshots its tool list once at build time, so servers that take longer than the 750ms wait_for_mcp_discovery() timeout are invisible for the whole session. Adds a threading.Event in entry.py that signals when background discovery completes. The server watches for this event after the first agent build and rebuilds the tool schema (agent.tools + agent.valid_tool_names) once the remaining servers land, without requiring /reload-mcp or /new.
Contributor
|
Thanks for the focused MCP late-discovery fix. This is an automated hermes-sweeper review; current
Closing as implemented on main. |
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.
MCP tool discovery runs in a background thread at TUI/Desktop startup so a slow server cant freeze the shell. The agent snapshots its tool list once at build time, so servers that take longer than the 750ms wait_for_mcp_discovery() timeout are invisible for the whole session.
This adds a threading.Event that signals when background discovery finishes. The server watches for it after the first agent build and rebuilds the tool schema once any remaining servers connect, without requiring /reload-mcp or /new.
Closes #38945