fix(capture): honor cancellation during ScreenCaptureKit retry sleeps#290
Closed
SebTardif wants to merge 2 commits into
Closed
fix(capture): honor cancellation during ScreenCaptureKit retry sleeps#290SebTardif wants to merge 2 commits into
SebTardif wants to merge 2 commits into
Conversation
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(capture): honor cancellation during ScreenCaptureKit retry sleeps This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
Contributor
Author
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.
What Problem This Solves
After a transient ScreenCaptureKit denial, three retry paths sleep with
try? await Task.sleepbefore a second attempt:ScreenCaptureFallbackRunner.runScreenCaptureFallbackRunner.runCaptureScreenRecordingPermissionChecker.hasPermissiontry?swallowsCancellationError, so a canceled capture or permission check can still run a full second ScreenCaptureKit attempt after the ~350ms delay.Closes #289
Evidence
Same cancel-swallow class as merged #270 / #271 / #267 / #230. Introduced with concurrent live-area capture stabilization in 6b2554a (2026-05-07).
Prior closed attempts (code was right; merge blocked on live SCK proof):
Changes
try await Task.sleepon all three transient-denial retry sleeps so cancellation aborts before the second SCK callscripts/prove-live-sck-cancel.sh(productionScreenCaptureFallbackRunner+ realSCStreamErrorDomain)Real behavior proof
Command:
bash scripts/prove-live-sck-cancel.shEnvironment: macOS arm64, Screen Recording available for host process; proof binary ad-hoc signed (Command Line Tools)
Before (unfixed / control path): non-canceled transient denial path performs 2 real SCStream start attempts (
control attempts=2)After (fixed / cancel path): cancel ~50ms into 350ms denial sleep yields 1 real SCStream start attempt and
CancellationError(cancel attempts=1, no second SCK call)Unit tests:
(all pass)
Live transcript (this host):
Related