Repository navigation
fix(linux): enumerate screens and windows in separate calls under X11 - #1065
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughThe IPC handler now enumerates source types separately on Linux unless the session indicates Wayland. The Nix smoke test now requires each of five enumeration attempts to return a display and requires export to succeed. ChangesDesktop source enumeration
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant GetSourcesHandler
participant getSourcesByType
participant desktopCapturer
GetSourcesHandler->>getSourcesByType: Pass options, getSources callback, and platform decision
loop Each requested source type when separate enumeration is enabled
getSourcesByType->>desktopCapturer: Call getSources with one source type
desktopCapturer-->>getSourcesByType: Return sources for that type
end
getSourcesByType-->>GetSourcesHandler: Return combined sources
Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change makes screen enumeration on Linux X11 more reliable and tightens the CI smoke test. No concrete merge-blocking issue was found. The author notes validation on a real X11 desktop and a GitHub runner is still pending. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 4 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Asking desktopCapturer.getSources for both types in one call intermittently fails the X11 screen capturer's thumbnail grab: Electron 41 never settles the call, Electron 43 settles after 3s without the screen. Measured under Xvfb: 7 failures in 16 combined runs, none in 32 runs with one type per call. Wayland keeps the single call, where splitting would raise the portal twice. Refs #462.
With enumeration split by type, the sources smoke test no longer has a known flake. Exit 0 with displays: [] now counts as a failure, and the verdict requires all attempts. Refs #462.
39c0210 to
9f6256c
Compare
Summary
Cause found. On X11, a single
desktopCapturer.getSourcescall that asks forscreenandwindowtogether makes the X11 screen capturer's thumbnail grab fail now and then (Failed to initialize pixel buffer). What the caller sees depends on Electron:returned 0 source(s) in 3003ms, i.e.displays: [], 4 of 5 times in run 37134061785.Fix.
get-sourceshandler asks for one type per call, one call after the other, on Linux X11 only. This coversopenscreen sources,openscreen recordand the GUI pickers.nix-build.ymlnow counts an attempt that exits 0 withdisplays: []as a failure. The verdict requires all 5 attempts, as the old comment asked once the cause was known.Related issue
Refs #462
Testing
Reproduced under Xvfb in WSL with a minimal Electron app, using the flake's
xvfb-runand its Electron 43.4.1 plus a stored Electron 41.0.2. Eight runs per cell:screen,windowin one callscreenthenwindowwindowthenscreenscreenalone (18 calls each)Failed to initialize pixel bufferline, and runs without a failure had none.The packaged app, A/B. I ran
nix build .#openscreenin WSL with a localnpmDepsHashpatch, thenopenscreen sources10 times underxvfb-run -a, the way the smoke step does:maindisplays: [])The
recordprobe now finds the screen. It still fails after that, withRecording did not start within 30s. That is a separate capture problem under Xvfb, and the probe stays informational.Unit tests and checks.
electron/ipc/desktopSourceTypes.test.tschecks the platform and Wayland gating, one type per call, that calls never overlap, the pass-through cases and error propagation.tscpasses for the app and test configs. Biome is clean.Not proven.
nix-build.ymlrun.select-source, source restore) are unchanged. They use 0×0 thumbnails and are not on the CLI path.Before CI can say anything,
nix-build.ymlonmainmust get past the build again. It currently fails on annpmDepsHashmismatch innix/package.nix, which this PR does not touch.🤖 Generated with Claude Code
Summary by CodeRabbit