fix: resolve MCP server connection race condition (reapply #5592) #5905
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.
This PR reapplies the fix from the automatically closed PR #5592 to resolve the MCP server connection race condition.
Problem
The original PR #5592 was automatically closed before the fix could be merged, but the issue #5591 still exists in the main branch. The race condition prevents MCP servers from connecting during extension startup due to conflicts with the read-only
vscode.extensions.all
property.Solution
This PR applies the same tested fix:
const extensions = [...vscode.extensions.all]
to avoid read-only property conflictsextension?.packageJSON?.contributes?.themes?.length > 0
for better error handlingChanges Made
src/integrations/theme/getTheme.ts
with the exact same fix that was tested in PR fix: resolve MCP server connection race condition (#5591) #5592Testing
The original PR #5592 showed:
References
This is a minimal, targeted fix that resolves the race condition while maintaining all existing functionality.
Important
Fixes race condition in
getTheme()
by using a local copy ofvscode.extensions.all
and adding null checks.getTheme()
ingetTheme.ts
by creating a local copy ofvscode.extensions.all
.extension
andpackageJSON
to prevent errors during iteration.This description was created by
for 897a11a. You can customize this summary. It will automatically update as commits are pushed.