Repository navigation
fix(desktop): pin preview CDP debugger across webview teardown - #223
Merged
Merged
Conversation
Keep the Electron Debugger wrapper alive for each preview control session and detach through that reference. Re-reading wc.debugger after destruction throws and can crash the browser process. Adapted from pingdotgg#9068.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Greptile SummaryPins each preview control session’s Electron debugger wrapper and consistently uses that retained reference for CDP attachment, commands, color-scheme emulation, listener cleanup, and detachment. This prevents garbage collection while Chromium retains the debugger client and allows cleanup after the associated webview has been destroyed. Confidence Score: 5/5Safe to merge. There are no outstanding findings. Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
This was referenced Sep 14, 2026
Merged
This branch was successfully deployed
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.
Problem
Heavy preview automation can SIGSEGV the desktop browser process. Electron's
webContents.debuggerwrapper is GC-managed but registered with Chromium as a raw pointer. Cleanup also re-readwc.debugger, which throws once the webview is destroyed, so detach was skipped.Changes
Pin the debugger reference on each preview control session and route attach, detach, sendCommand, and color-scheme emulation through it. A new test destroys the webview getter and still expects detach.
Adapted from pingdotgg#9068. Preview artifact transfer remains with the remote-media worker.
Scope
This PR is debugger lifetime only.
Covered here:
Still assigned to this handoff, in later PRs:
Verification
vp test run apps/desktop/src/preview/Manager.test.ts: 73 passed, including the destroyed-webview detach case.vp linton the two files: no new errors.Native Electron crash reproduction was not run on this Linux host.
Implemented and verified by Grok 4.6 High in Grok Build via Orca.