Problem#
Locking a macOS desktop host can make agent screenshots time out and remote viewers wait for frames, while page evaluation and navigation continue working. Native guest capture also can return pixels from before a just-completed DOM change.
Continuation of #27092 by @mhodgson, rebased onto a686952304a5, with the original commits and author preserved. Our affected-user report is here.
Change#
Keep server-driven macOS webviews paintable behind the app and route supported root viewport PNG/JPEG captures through Electron native guest capture. Preserve current iframe pointer routing, annotation guards, cookie clearing, focus ownership and screenshot queues.
For freshness, run a native warmup alongside a bounded paint probe in an isolated world, then capture the final image. The probe crosses a compositor paint boundary after preceding DOM changes. If readiness cannot be confirmed, fail instead of returning unconfirmed pixels.
Unsupported options, clipping, beyond-viewport, WebP, child sessions and other platforms retain CDP. Background rendering may consume more energy; that impact is unmeasured.
Scope#
One existing screenshot bug, documented in #27092 and related #24852; no feature or architecture change. The original branch could not be updated from this account. This PR remains the continuation for review.
Verification#
Candidate 8a3d499027cf884805fbc9bad2e8d4ca30192e50, physical Apple Silicon Mac, macOS 15.8.2; same Electron/Chromium for both variants.
- Stale-frame reproduction: previous helper returned old pixels in 23/30 immediate DOM colour changes; fixed helper returned correct pixels in 30/30. New regression assertion fails against the previous helper and passes with the fix.
- Locked-host comparison: exact-base production host/snapshot path passed unlocked controls, then failed to produce a screenshot while lock stayed confirmed. Candidate passed 6/6 unlocked, 6/6 locked, 6/6 after unlock.
- Candidate checks compared changing PNG pixels and current snapshot text, JPEG pixel values transferred over a separate loopback WebSocket, and real text/click input through the CDP relay. Every locked candidate check recorded lock confirmed before and after.
- 79 focused capture/host/input tests pass.
vp run check:changed origin/main passes format, lint, both knip checks, affected typechecks, focused tests and selected React compiler checks. Full upstream CI still needs maintainer approval.
Findings and reproduction · JSON records, logs, screenshots, fixture and candidate diff

Coverage boundary: the small standalone probe directly bundles and runs production DesktopBrowserHost, ServerBrowserPage.snapshot, captureViewport and the webview style resolver, with real sandboxed Electron guests and Playwright. Rebuilding from this final source produced a byte-identical tested bundle. It is not a complete separately installed T3 build. The JPEG socket is a thin fixture, not the full viewer UI/ServerBrowser.attachViewer//api/preview-stream/ws; MCP HTTP/authentication transport was not exercised. Additional OS versions and those full-app integrations remain unverified. A separate Dev instance initially started for broader checks was stopped at the user's request; installed T3 and live data were untouched.
Original fix: Matt Hodgson (@mhodgson), authored with GPT-6.1 Sol / Codex. Rebase, freshness fix and validation: GPT-6.1 Sol through the Codex harness on behalf of @JayHopsHQ.
No actionable comments were generated in the recent review.
Walkthrough
On macOS, top-level screenshot commands with supported options use native guest capture after paint-boundary confirmation. Other screenshot commands continue through CDP. The hosted webview style also keeps macOS server-driven webviews visible and viewport-sized when inactive.
Changes: macOS hosted browser capture
apps/web/src/browser/HostedBrowserWebview.tsx,apps/web/src/browser/hostedBrowserWebviewStyle.tsserverDrivenonly on macOS. The visible, viewport-sized inactive style applies whenrenderingActiveorserverDrivenis true.apps/desktop/src/preview/GuestCapture.ts,apps/desktop/src/preview/GuestCapture.test.ts,apps/desktop/src/preview/DesktopBrowserHost.ts,apps/desktop/src/preview/DesktopBrowserHost.test.tscaptureGuestPageforwards unsupported options to CDP. For supported options, it confirms a paint boundary and returns native PNG or JPEG capture data as base64. The host routes top-level macOS screenshot commands through the helper. Tests cover capture behavior and routing on macOS and Linux.Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Sequence Diagram(s)#
Possibly related issues
Suggested reviewers:
juliusmarmingeMerge Risk:
Minimal · up to
8a3d4This change lets agent screenshots and remote browser viewers keep working on macOS while the host is locked. Other platforms and unsupported capture options keep their existing behavior. No actionable merge-blocking risk remains after review. Background rendering energy use and a full installed-app end-to-end run are unmeasured.
Pre-merge checks:
4
Full details: Title check
Explanation
The title names the main change: a fix that captures browser tabs while the macOS host is locked. It follows the conventional commit format and matches the objectives, which describe routing macOS root-viewport screenshots through native guest capture so locked-host captures keep working. The title does not mention the rebase or the CDP fallback, which is acceptable because it need not cover every detail.
Full details: Description check
Explanation
The description is detailed and covers the problem (macOS locked-host screenshot timeouts and stale frames), the change (server-driven macOS webviews kept paintable, supported root viewport PNG/JPEG captures routed through Electron native guest capture, CDP retained elsewhere), scope (one existing bug linked to
#27092and#24852, no feature), and verification (specific reproduction counts, a locked-host comparison, 79 focused tests, check:changed run, and a stated coverage boundary). It also ends with the authoring model attribution required by the template. Minor gap: the Scope section does not clearly state the issue that shows the bug beyond prior PR references, and the Problem section does not give a clean one-line expected-behavior statement, but these are non-critical. The template's conventional commit title is not visible in the description body, which the template places in a comment rather than a required section.Finishing Touches
Generate unit tests (beta)
c05b91c7-ef5f-43ea-942e-0b93f8dda8ecReviewing files that changed from the base of the PR and between ca7fb55e9619580d2fb39226827a6a61912e2e5d and 8a3d499027cf884805fbc9bad2e8d4ca30192e50.
apps/desktop/src/preview/DesktopBrowserHost.test.tsapps/desktop/src/preview/GuestCapture.test.tsapps/desktop/src/preview/GuestCapture.tsIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.