fix(desktop): revert broken chrome-devtools-mcp/browser PRs, re-implement with fixes#1673
Merged
benjaminshafii merged 6 commits intodevfrom May 6, 2026
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ixed) Re-implements both features with fixes for the issues found in #1670/#1671: Fixes from PR1 (chrome-devtools-mcp bundling): - Use 'node' string literal instead of process.execPath in the IPC handler — process.execPath in Electron is the Electron binary, not node, so OpenCode couldn't spawn the command - Fix args filter to only carry --prefixed flags (not -y from npx) - Fix mcp.add fallback path to use resolved command from mcpEntryConfig instead of the original entry.command Fixes from PR2 (embedded browser panel): - Guard against zero-dimension bounds on first render — skip browser.show() until the panel has non-zero dimensions, let ResizeObserver trigger the actual show - Defensive try/catch in destroyBrowserView for already-destroyed webContents Verified: - resolveChromeDevtoolsMcpBin returns ['node', '<abs-path>'] (not ['Electron', '<path>']) - All 17 existing tests pass - Electron app starts and loads successfully - CDP targets visible at the remote debugging port
…engine start When the OpenCode engine starts in the Electron desktop app, ensureOpencodeConfig now automatically adds a chrome-devtools MCP entry to opencode.json if one doesn't already exist. The command uses the bundled chrome-devtools-mcp package (['node', '<abs-path>']) so no npm/npx is needed at runtime. This mirrors what Tauri's ensure_workspace_files() does in files.rs for the starter preset, making Control Chrome a zero-setup default for all Electron workspaces.
ensureOpencodeConfig in runtime.mjs only runs when the OpenCode engine starts, which happens asynchronously after the workspace is selected. New workspaces were left without a chrome-devtools entry because the engine hadn't started yet. Fix: call seedChromeDevtoolsMcp(folderPath) directly inside the workspaceCreate IPC handler so the config is written synchronously during workspace creation. The runtime.mjs ensureOpencodeConfig remains as a backup for workspaces created before this change. Verified: created a workspace via IPC, confirmed opencode.jsonc contains chrome-devtools with ['node', '<bundled-bin-path>'].
…dled node path Existing workspaces created by Tauri or older Electron versions have chrome-devtools MCP entries with npx-based or bare-binary commands like ['npx','-y','chrome-devtools-mcp@latest'] or ['chrome-devtools-mcp']. Both seedChromeDevtoolsMcp (main.mjs, runs at workspace creation) and ensureOpencodeConfig (runtime.mjs, runs at engine start) now detect these legacy commands and migrate them to the bundled ['node', path] command. User-customised commands (absolute paths, etc.) are preserved.
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
Reverts the two broken PRs (#1670, #1671) and re-implements them with fixes.
Bugs found and fixed
resolveChromeDevtoolsMcpBinIPC returned[process.execPath, binPath]—process.execPathin Electron is the Electron binary (e.g..../Electron.app/.../Electron), notnode. OpenCode couldn't spawn it."node"string literal instead ofprocess.execPath-yflagarg.startsWith("-")matched npx's-yflag and passed it to chrome-devtools-mcparg.startsWith("--")onlymcp.addSDK call at store.ts:590 usedentry.command(original npx command) instead of the resolved commandmcpEntryConfig["command"]which has the resolved valuegetBoundingClientRect()on first render could return{width: 0, height: 0}before layout settlesbrowser.show()until dimensions are non-zero, let ResizeObserver trigger itwebContents.close()could fail if already destroyed with parent windowVerification
Files changed
apps/desktop/package.jsonchrome-devtools-mcp@0.17.0dependencyapps/desktop/electron/main.mjsresolveChromeDevtoolsMcpBinIPC (uses"node"notprocess.execPath)apps/desktop/electron/preload.mjsbrowser.*methodsapps/app/src/app/mcp.tsresolveChromeDevtoolsMcpCommand()apps/app/src/app/lib/desktop.tsapps/app/src/react-app/domains/connections/store.tsapps/app/src/react-app/domains/session/browser/browser-panel.tsxapps/app/src/react-app/domains/session/chat/session-page.tsxapps/desktop/scripts/chrome-devtools-mcp-shim.tsapps/desktop/scripts/prepare-sidecar.mjs