Repository navigation
fix(browser): bound screenshot hangs and recover CDP session - #1591
Merged
vastsa merged 7 commits intoOct 12, 2026
Merged
Conversation
Tested: node --test apps/desktop/test/browser-capture-resize.test.mjs # Subtest: capture completion after native guest destruction preserves the original capture result ok 12 - capture completion after native guest destruction preserves the original capture result --- duration_ms: 0.3673 type: 'test'
Keep the translated E2E scenario and plugin API aligned with the English contract so both locales describe the same 30-second timeout behavior.
The main branch advanced during review. Preserve the contributor's commit and bring the request candidate up to date before rerunning validation.
The dedicated Electron capture/resize scenario was not part of the CI suite, leaving native window transitions unverified. Run it in the existing Xvfb job that installs Electron so the timeout recovery path is checked in a supported display environment.
Xvfb provides an X server but no window manager, so native full-screen state changes never completed in the new capture/resize scenario. Start Openbox for that step so the regression test exercises the desktop window transitions it asserts.
vastsa
pushed a commit
that referenced
this pull request
Oct 13, 2026
#1591 gave screenshots a 30s deadline, but snapshot, click, fill, evaluate and every other allow-listed cdpCommand still had none — a page holding a native dialog open or running a busy loop hangs those tool calls forever, the same failure class as #1510 (#1611). The screenshot deadline becomes a generic withCdpDeadline over any CDP round trip on the guest, wired into all five call sites with per-call labels; the timeout recovery (detaching the debugger session) and the TIMEOUT error code are unchanged, and calls that finish in time clear their timer with no side effects.
Closed
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
Issue #1510 reports browser screenshots hanging until the outer plugin-tool budget expires. The issue logs show repeated screenshot calls each waiting about 110 seconds; the capture queue has no per-capture deadline, and the stalled CDP session can remain attached.
Solution
Bound both the bundled screenshot API and raw
Page.captureScreenshotCDP calls to 30 seconds. On timeout, returnTIMEOUT, detach the stalled BrowserCdp session, and release the per-page capture queue so the next call can reattach and proceed. Other CDP methods are unchanged.Testing
node --test apps/desktop/test/browser-capture-resize.test.mjs— 12 tests passed.pnpm --filter @pi-desktop/desktop typecheck— passed.pnpm --filter @pi-desktop/desktop lint— passed.node docs/scripts/check-docs.mjs— passed (570 pages; existing ADR-format notes remain).git diff --check— passed./bin/basherrors), so those failures are not claimed as passing.Issue alignment
Refs #1510. This follows the maintainer's suggested per-capture 15–30 second timeout and queue recovery; detaching the CDP session on timeout ensures a stuck command does not retain the page's debugging session.