Skip to content

Conversation

roomote[bot]
Copy link

@roomote roomote bot commented Jul 18, 2025

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:

  • Create local copy of extensions array: const extensions = [...vscode.extensions.all] to avoid read-only property conflicts
  • Add defensive null checking: extension?.packageJSON?.contributes?.themes?.length > 0 for better error handling
  • Use local array for iteration: Prevents race condition between MCP initialization and theme loading

Changes Made

Testing

The original PR #5592 showed:

  • ✅ All ClineProvider tests pass (87 passed)
  • ✅ All shared tests pass (222 passed)
  • ✅ All core tools tests pass (95 passed)
  • ✅ No linting errors
  • ✅ All type checks pass

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 of vscode.extensions.all and adding null checks.

  • Behavior:
    • Resolves race condition in getTheme() in getTheme.ts by creating a local copy of vscode.extensions.all.
    • Adds null checks for extension and packageJSON to prevent errors during iteration.
  • Testing:

This description was created by Ellipsis for 897a11a. You can customize this summary. It will automatically update as commits are pushed.

- Create local copy of vscode.extensions.all to avoid read-only property conflicts
- Add defensive null checking for extension and packageJSON
- Resolves race condition between MCP initialization and theme loading
- Reapplies fix from automatically closed PR #5592

Fixes #5591
@roomote roomote bot requested review from mrubens, cte and jr as code owners July 18, 2025 17:32
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Jul 18, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 18, 2025
@daniel-lxs
Copy link
Collaborator

Completely unrelated to the issue

@daniel-lxs daniel-lxs closed this Jul 19, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 19, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:S This PR changes 10-29 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Failed to connect to MCP servers in v3.23.6: TypeError: Cannot assign to read only property 'all' of object '[object Array]'
3 participants