fix(desktop): bound preview recording warmup #20085
main fromrefs/pull/20085/head·merged by juliusmarminge View on GitHubSummary#
If Electron never settles a native capturePage warmup, recording START holds the tab lifecycle lock indefinitely and STOP stays queued. Give each warmup attempt the existing one-second capture deadline so stalled warmups release the lock. The two immediate attempts and best-effort native recording handoff remain unchanged.
Validation#
Deterministic red/green regression, 103 Manager tests, and focused static checks
Validated source 1eb70db873408c760606c925e4c14e6c9439a7d9 on Windows:
- The retained regression fails against unchanged Manager source from
13aa882c22d584de5388dfce3b3ca413387ba059on the same host: STOP remains queued after two seconds of TestClock time. With the fix, it verifies both warmup attempts, restored recording activity/cursor, and no capture reentry after late native completion. No sleeps or polling. vp test run apps/desktop/src/preview/Manager.test.tspasses all 103 tests, including main-window-close-during-warmup coverage.vp run --filter @t3tools/desktop typecheckexits 0.vp lint apps/desktop/src/preview/Manager.ts apps/desktop/src/preview/Manager.test.ts --report-unused-disable-directivesexits 0.vp fmt --check apps/desktop/src/preview/Manager.ts apps/desktop/src/preview/Manager.test.tsandgit diff --checkpass.
One lint warning and two advisory Effect suggestions remain on unchanged lines and are retained in the proof.
This changes Electron Manager service liveness without changing a frontend flow. No integrated UI/mobile or OS display-state test was performed. Native promises remain uncancellable; their Effect waits are interrupted. The fake native recording handoff settles normally, so this proves warmup liveness, not recovery from real compositor hangs or native acquisition failures. Hosted CI and review of this source are separate from these local results.
Proof#
Behavioral reproduction, exact tested source, command output, source patch and limits.
🤖 Generated by GPT 6.1 Sol in Codex via T3 Code.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
855457cMacroscope's review found this PR approvable — This is a narrowly scoped desktop bug fix that bounds an existing recording warmup, preserves its best-effort retry behavior, and releases queued STOP operations after stalls. The added deterministic regression test covers cleanup and late native completion, with no product-default, schema, deployment, or static-analysis changes.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
d4437c2d-e413-4377-bf63-dedfc07b5079
📥 Commits
-
Reviewing files that changed from the base of the PR and between 855457c2df1094f2351aaa915cafe4682b7c479c and 66e4711b226a10ca917c83ddc7208484083ce526.
📒 Files selected for processing: 2
-
apps/desktop/src/preview/Manager.test.tsapps/desktop/src/preview/Manager.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
📝 Walkthrough
-
Recording warmup attempts now time out after 1,000 ms and retry once. A new test checks that stopping a recording completes while warmups remain stalled, restores throttling and cursor state, and denies a display-media request after a late warmup completes.
Changes: Recording warmup
Layer / File(s) Summary Timed capture retry and stop behavior
apps/desktop/src/preview/Manager.ts,apps/desktop/src/preview/Manager.test.tsEach warmup capture attempt times out after 1,000 ms. Capture failures and timeouts become PreviewOperationError, and the code retries once. The test checks stop behavior, restored throttling and cursor state, and denial of a display-media request after late warmup completion.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~12 minutes
Change: Bug fix
Suggested reviewers:
juliusmarminge
Merge Risk: ⚪ Minimal · up to
66e47-
No actionable issue remains in the reviewed recording-warmup change; it is ready to merge after normal checks.
Security architecture risk: 🔵 Low · up to
66e47-
The change improves recording-stop recovery and preserves the existing capture-permission checks. Its scope is local to desktop preview recording. Native capture remains uncancellable, so limiting the wait does not guarantee that underlying capture work has finished.
Retained concerns No architecture-level concerns identified.
Security review details
-
Security Blast Radius
- inferred — The demonstrated impact is confined to recording coordination and native capture work in the desktop process. The changed code does not introduce a new remote caller, cross-service dependency, credential authority, or persistent-state transition.
Trust Boundaries and Controls
- inferred — The timeout does not itself grant capture authority or weaken requesting-frame checks. A late warmup result has no state-mutating continuation, while queued stop removes the pending grant before later display-media requests can use it.
Resilience and Maintainability Implications
- observed — The timeout interrupts waiting, not Electron capturePage itself. A retry can therefore begin while an earlier native attempt remains pending. Manager-owned cleanup is inspectable, but native resource reclamation and accumulation across repeated timed-out starts are not established by this evidence.
-
Pre-merge checks:
3 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Description check The description clearly explains the problem, change, verification steps, test results, and known limits. It does not include the required Scope and approval section or explain issue tracking or maint… Add a Scope and approval section. Link the triaged issue or explicit maintainer approval, or explain why this focused bug fix qualifies without prior approval. Passed checks: 3 passed-
Check name Status Explanation Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Title check The title clearly and concisely describes the main change: adding a bound to desktop preview recording warmup.
Full details: Description check
-
Explanation
The description clearly explains the problem, change, verification steps, test results, and known limits. It does not include the required Scope and approval section or explain issue tracking or maintainer approval.
Resolution
Add a Scope and approval section. Link the triaged issue or explicit maintainer approval, or explain why this focused bug fix qualifies without prior approval.
-
- Fix all pre-merge checks with AI
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge merged thisa31f1f2
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes