Repository navigation
agentHost: keep MCP servers starting until their tools load - #341881
Merged
Connor Peet (connor4312) merged 2 commits intoOct 16, 2026
Merged
Connor Peet (connor4312) merged 2 commits into
Connor Peet (connor4312) merged 2 commits into
Conversation
Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Older-runtime connection and reconnect events can leave usable servers stuck in Starting until another inventory refresh.
1 open finding
What changed in this PR
Keeps Agent Host MCP servers Starting until their tools load, avoiding premature Ready status during slow initialization.
Changes:
- Exposes the runtime’s tools-loaded event.
- Tracks tool readiness through lifecycle events and inventory.
- Adds readiness and inventory-race tests.
| File | Description |
|---|---|
| src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts | Tests tool readiness, compatibility, and inventory races. |
| src/vs/platform/agentHost/node/copilot/copilotSessionWrapper.ts | Exposes the tools-loaded event with local types. |
| src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts | Gates Ready status on tool availability while preserving blocking state. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Aaron Munger (amunger)
previously approved these changes
Oct 15, 2026
…ols load Older runtimes never emit session.mcp_server_tools_loaded, so a server that connected (or reconnected) after the initial inventory stayed Starting. Refreshing listConfigured on connection lets inventory toolsLoaded, or its absence on older runtimes, decide readiness. Co-authored-by: Copilot <[email protected]>
Dmitriy Vasyura (dmitrivMS)
approved these changes
Oct 16, 2026
1 task done
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.

Refs #341543. Pairs with the runtime change github/copilot-agent-runtime#26938.
An MCP server can report
connectedbefore it has answeredtools/list. Today the agent host shows such a server as Ready even though the turn is still waiting on its tools. With a server that never answerstools/list(for example GitKraken'sgk mcp, see gitkraken/vscode-gitlens#5994), that looks like a Ready server and a chat that hangs for minutes.This PR keeps the server in Starting until its tools have loaded:
CopilotSessionWrapperexposes the runtime's newsession.mcp_server_tools_loadedevent asonMcpServerToolsLoaded. The bundled SDK types don't include this event yet, so its type is declared locally.CopilotAgentSessiontranslates aconnectedSDK status to Starting until that server's tools have loaded. It also keeps the server's blocking state, so "move to background" still applies.mcp.listConfigured, the session reads the newlive.toolsLoadedfield.truemarks tools loaded andfalsemarks them pending. If the field is missing (an older runtime), aconnectedserver is treated as loaded, which is the current behavior.How to test
chat.agentHost.copilot.runtimePathsetting.initializebut sleeps for about 30s before answeringtools/list.With an older runtime, behavior is unchanged.