Repository navigation
perf(rune-mcp): attach client MCP only to active/open folders, not all sidebar projects - #2025
Merged
Merged
Conversation
…l sidebar projects
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This was referenced Dec 1, 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.
Summary
Stops
rune_mcp::sync_windowfrom eagerly attaching aruneclient MCP WebSocket (GET /api/experimental/client-mcp?location[directory]=…&name=rune) to every sidebar project inused_projects()on launch, and fixes Windows case-only duplicate folder attaches and cross-server tab folder leaks.Refs #1649
Root cause
GET /api/experimental/client-mcp?location[directory]=<dir>&name=runeWebSocket forces the local OpenCode server to boot a full project location instance (loading plugins, starting file watchers, and spawning every configured stdio MCP server for that folder).sync_windowadded every folder inhost.used_projects()tofolders, even when no tab, active session, or active draft was open in that folder. With a ~200 MB Node.js stdio MCP server configured and 6 sidebar projects, this booted 7 server locations at launch and spawned 7 separate Node.js MCP processes (~1.38 GB) plus ~423 MB in the Bun server sidecar whileOpenCode (Rune)itself used ~58 MB.rune_mcp's call router (match_window) only ever routes calls to open tabs (open_roots) or the active session route (routed_exact/routed_root) and rejects all other sessions withSESSION_NOT_OPEN_ERROR, so attaching to unopened sidebar projects served no routing purpose.foldersandRuneMcpHub::connectionskeyed directories case-sensitively, so two paths on Windows differing only in letter casing or separator booted duplicate server locations, and tab iteration did not filter tabs to the active server.Changes
features/workspace-tools/src/rune_mcp/mod.rs:runeclient MCP only to folders with an active session/draft route or an open tab on the active server (removingfor p in host.used_projects()).RuneMcpHub::connectionswith Windows case- and separator-insensitive normalization (folder_key) while preserving the raw cleaned directory path on the wire.open_rootsto tabs belonging toactiveserver, and drop unusedused_project_ids/projects/used_projectsmethods fromRuneMcpHostandsync_stamp.apps/desktop/src/workspace/lifecycle/rune_mcp.rs:RuneMcpHosttrait method implementations andProjectimport.Verification
pwsh scripts/guardrails.ps1(11/11 passed)cargo check -p opencode-feature-workspace-tools -p opencode-desktop(pass)cargo clippy --no-deps -p opencode-feature-workspace-tools -- -D warnings(pass, 0 warnings)cargo clippy --no-deps -p opencode-desktop(0 warnings in touched files)