mcp: skip startup for removed server definitions - #336946
Merged
Merged
Conversation
Treat a collection or definition removed during discovery reconciliation as a cancelled start instead of throwing. Log the skipped startup and preserve genuine lazy-load, delegate, and enterprise policy errors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Dmitriy Vasyura (dmitrivMS)
September 20, 2026 19:36
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused lifecycle fix is consistent with caller behavior and has comprehensive regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Prevents stale MCP entries from failing startup after their collection or definition is removed.
Changes:
- Return a stopped-start result with debug logging for removed entries.
- Document the expanded
undefinedresult. - Add removal-race and error-preservation tests.
| File | Description |
|---|---|
mcpRegistry.ts |
Gracefully skips removed MCP entries. |
mcpRegistryTypes.ts |
Documents resolution behavior. |
mcpRegistry.test.ts |
Covers removal races and preserved errors. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Dmitriy Vasyura (dmitrivMS)
marked this pull request as ready for review
September 20, 2026 19:53
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 20, 2026 19:53
Sandeep Somavarapu (sandy081)
approved these changes
Sep 20, 2026
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 discovery can unregister a collection before the workbench's debounced server list removes its entry. Starting that stale entry currently rejects with
Collection or definition not found.Treat a collection or definition that is no longer registered as a cancelled connection resolution: emit a debug log and return the existing no-connection result. The caller already handles that result as a stopped start. This also covers removal while a lazy collection is loading, without catching or suppressing genuine loader, delegate, or enterprise policy errors.