Skip to content

fix(desktop): restore fresh human background screenshots - #22335

Open
Quicksaver wants to merge 1 commit into
pingdotgg:mainfrom
Quicksaver:fix/restore-preview-background-screenshots
Open

Quicksaver wants to merge 1 commit into
pingdotgg:mainfrom
Quicksaver:fix/restore-preview-background-screenshots

Conversation

@Quicksaver

@Quicksaver Quicksaver commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The human Screenshot action can save stale pixels or fail to save an image when Electron stops presenting a background preview, including when the desktop app is hidden. The saved image should contain the current page pixels.

Change

Each capture keeps rendering active while a bounded paint probe runs alongside a discarded warmup capture, then saves the final native readback.

Overlapping screenshots retain independent rendering ownership alongside recording and picture-in-picture. If paint readiness cannot be confirmed, capture uses available pixels without guaranteeing freshness. Native capture promises remain uncancellable.

Scope and approval

This restores the human native screenshot path from #19931. Julius requested a fresh PR with before/after evidence on each affected platform. It applies to Electron desktops on Windows, macOS and Linux. Human approval remains outstanding.

Verification

70 focused tests, changed-file checks and historical desktop proof
  • All 70 focused cases passed with vp test run src/preview/Manager.test.ts src/ipc/methods/preview.test.ts from apps/desktop. Desktop typecheck, touched-file lint, formatting and git diff --check c677d5fc45e6d585e52bca03244a0870c588a555 HEAD passed at f75f20b7decd59aaa0ce3d7897b89ced222d0716, directly above pinned base c677d5fc45e6d585e52bca03244a0870c588a555.
  • vp run check:changed c677d5fc45e6d585e52bca03244a0870c588a555 passed on this HEAD: formatting, lint, both knip passes, affected-package typechecks and 65 Manager cases. Vitest reported a nonfatal shutdown warning that nine Vite servers did not exit within its close timeout; the command exited successfully.
  • The shell uses Node 24.15.0; the repository requests 26.12.1. The changed-file check runner used the Vite+ Node 26.12.1 executable. The earlier focused test process's Node version was not separately measured.
  • Native proof compares BEFORE 8eafe058ca7720219e9466e9c6ed8e59a2276dee with AFTER 2e619fae61e66ecd85dd8494a431668920d06af2. It does not verify the current head. The multi-model review attribution below also applies only to that historical AFTER revision.
  • Both revisions passed vp run build:desktop on Windows 11 x64, macOS 27.0.1 ARM64 and Debian 12 x64, using Electron 44.4.5. Complete unpackaged apps contained imported conversation history. Tests used the human Screenshot control through production IPC/Manager and independently decoded the saved PNGs.
  • Windows hidden and overlapping-hidden captures failed BEFORE and saved fresh PNGs AFTER, including a hidden target with the display off. Linux saved five of eight requested PNGs BEFORE and eight distinct fresh PNGs AFTER. Both macOS revisions saved fresh PNGs in the measured cases, including locked with the display off. Normal, inactive, minimized, PiP and close/reopen cases saved fresh PNGs on all three platforms.
  • Limits: Linux used Docker Desktop WSL2, Xvfb/Openbox/picom and software rendering. Physical display/lock, hardware GPU, Wayland and installed AppImage behavior are unverified. No natural macOS failure was observed; its test-keychain flag leaves OS-backed credential sealing unverified. Recording quality, pending macOS cancellation, frozen-probe fallback, replacement retaining the exact runtime tab identity and OS-wide foreground-process preservation were not demonstrated. The human control stops recording instead of acquiring a concurrent still.

Proof

Historical before/after PNGs and reproduction evidence

Windows/macOS proof package and Linux proof package include saved images, failed requests, pixel checks, hashes, reproduction drivers and limitations. Uploads were downloaded and hash-verified.

Hidden app, requested epoch 4:

Platform Before After
Windows No PNG returned; failed request retained in the package. Windows Screenshot saves fresh epoch 4
Linux No PNG within the 12-second observation window. Linux Screenshot saves fresh epoch 4
macOS macOS before saves fresh epoch 4 macOS after saves fresh epoch 4

The macOS originals are byte-identical and the upload service deduplicated them. Missing before images reflect failed captures. The Linux observation window is not an application timeout guarantee.

🤖 Generated by GPT 6.1 Sol in Codex via T3 Code.
🤖 Reviewed until clean by GPT 6 Astra, GPT 6.1 Sol, Claude Fable 5.1, Claude Opus 5.5, CodeRabbit. Findings that reach consensus across the majority were addressed by the generation model.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Oct 20, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — This restores fresh background screenshots by adding compositor paint probing, a discarded warmup capture, and independent rendering leases around the existing production screenshot path. Because it changes throttling, debugger coordination, timing, and overlap behavior across screenshot, recording, and picture-in-picture flows, the runtime impact merits human review.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 5211acf and f75f20b.

Files selected for processing: 2
  • apps/desktop/src/preview/Manager.test.ts
  • apps/desktop/src/preview/Manager.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

Still-image screenshot capture now uses a separate rendering lease. It runs a warmup capture while checking paint readiness with a bounded probe, then performs a final retried capture. Tests cover overlapping and interrupted captures, guest replacement, debugger handling, timeouts, and throttling restoration.

Changes: Still-image capture

Layer / File(s) Summary
Capture workflow and lifecycle coverage
apps/desktop/src/preview/Manager.ts, apps/desktop/src/preview/Manager.test.ts
captureScreenshot now uses captureStillImage. The helper acquires and releases a still-image rendering lease, runs a warmup capture alongside a bounded paint-readiness probe, and obtains the final image through the retrying capture helper. Tests cover retries, overlapping and interrupted captures, guest replacement, debugger handling, timeouts, and throttling restoration.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant captureScreenshot
  participant captureStillImage
  participant WebContents
  participant ControlDebugger
  captureScreenshot->>captureStillImage: request image capture
  captureStillImage->>WebContents: start warmup capture
  captureStillImage->>ControlDebugger: probe paint readiness
  ControlDebugger-->>captureStillImage: return readiness or timeout
  WebContents-->>captureStillImage: return warmup result
  captureStillImage->>WebContents: perform final retried capture
  captureStillImage-->>captureScreenshot: return image
Loading

Possibly related issues

Possibly related PRs

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to f75f2

No concrete issue is identified that should block merging. Native screenshot validation on the reviewed head remains useful before release.

Security architecture risk: Low · up to 96715

The change adds local rendering coordination without introducing a new screenshot entrypoint or increasing debugger authority. Independent capture ownership, guest-identity checks and cleanup limit interference with other preview activity. Paint freshness remains best-effort when readiness cannot be confirmed.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The additional runtime exposure is local to the desktop capture lifecycle: the main window's rendering throttling, participating preview guests and their shared recording or picture-in-picture ownership. The inspected change does not add a server capture path, credential access or a new artifact destination.

Trust Boundaries and Controls

  • observed — The readiness probe uses only a control session already owned by the manager; it does not attach a debugger to obtain a screenshot. Existing control-session acquisition refuses DevTools or foreign debugger ownership. Added regressions assert that foreign ownership permits fallback capture without debugger attachment or commands.

Resilience and Maintainability Implications

  • observed — Lifecycle regressions cover overlapping requests, recording and picture-in-picture coexistence, interruption, guest replacement and late warmup completion. Together with consumer-specific release and current-guest checks, these provide source-level counterevidence to premature ownership release or publication of replaced-guest pixels; they are not independent native-platform execution proof.
Pre-merge checks: Passed 4
Check name Status Explanation
Description check Passed The description includes all required sections. It explains the problem, implementation, scope and approval context, focused verification, platform limits, and evidence links. It also identifies the a…
Title check Passed The title clearly and concisely identifies the main change: restoring fresh screenshots for the desktop application.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes all required sections. It explains the problem, implementation, scope and approval context, focused verification, platform limits, and evidence links. It also identifies the agent and harness used.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@Quicksaver
Quicksaver force-pushed the fix/restore-preview-background-screenshots branch 2 times, most recently from 96715e4 to cb74756 Compare October 24, 2026 00:02
@Quicksaver

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@Quicksaver
Quicksaver force-pushed the fix/restore-preview-background-screenshots branch from cb74756 to 7a2b3e9 Compare October 25, 2026 19:05
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Oct 25, 2026
@Quicksaver
Quicksaver force-pushed the fix/restore-preview-background-screenshots branch 2 times, most recently from afa93bf to 19fb1df Compare October 27, 2026 14:41
@Quicksaver

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

No files to review.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Quicksaver

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

Keep each human capture rendering through a bounded paint probe and
warmup, then save the final native pixels. Let overlapping probes
progress independently while retaining recording and PiP ownership.

Co-authored-by: Julius Marminge <julius0216@outlook.com>

> 🤖 Generated by GPT 6.1 Sol in Codex via T3 Code.
@Quicksaver
Quicksaver force-pushed the fix/restore-preview-background-screenshots branch from 19fb1df to f75f20b Compare October 28, 2026 15:49
@Quicksaver

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant