Skip to content

fix(preview): stop repeated macos screen capture consent alerts - #1463

Merged
nixuuu merged 1 commit into
devfrom
fix/macos-capture-graceful-exit
Nov 29, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/macos-capture-graceful-exit

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 29, 2026

Copy link
Copy Markdown
Member

Problem

During Desktop automation macOS kept showing "Canopy is requesting to bypass the system private window picker…" although the user had allowed it many times. The replayd approval for app.canopy.desktop stayed in place (kScreenCaptureApprovalLastAlerted unchanged for weeks), so the answers were never stored.

The replayd log shows why. macOS checks consent after each frame by resolving the capturing process. Every alert came right after the window preview's capture helper disconnected:

client disconnected, successfully stopped active session
approveOnStreamStart…
[ERROR] requireAlertWithCanonicalBundleID… Error resolving binary path and audit token
userAcknowledgementAlertWithBundleID → showAlert

The preview killed the helper with SIGKILL right after a frame when the target changed or the preview stopped (desktop-follow-preview.ts). replayd could no longer resolve the process, so it showed the alert and had nothing to store the answer for.

Fix

  • Stopping the capture ends the helper's stdin instead of killing it. The helper finishes the outstanding frame and exits one second after its last one. SIGKILL stays as a fallback after 4 s (the helper bounds one capture at 2.5 s).
  • next() returns as soon as the capture stops and no longer waits for an outstanding frame. The failure path in the follow preview no longer waits for the helper to exit before falling back to Agent Desktop screenshots; the preview's close() still awaits it.
  • docs/automation-tools.md describes the behaviour.

Fixes: #1284

Verification

  • Locally: worker typecheck, oxlint and oxfmt on the changed files, bun run check:tmp ./apps/worker/src/agent-preview/desktop-follow.test.ts (6 pass).
  • A Bun simulation of the parent/helper protocol confirmed the outstanding frame is still delivered after stdin ends and the helper exits about 1 s after it.
  • Not verified on macOS: this worker runs Linux. To confirm on a nightly build, keep log stream --info --predicate 'process == "replayd"' running while the agent switches windows. Error resolving binary path and audit token and the alert should no longer appear.
  • No new test: the path needs ScreenCaptureKit and replayd, and the existing follow tests cover the preview wiring on Linux.

🤖 Generated with Claude Code

macOS checks direct-capture consent only after a frame, by resolving the
process that captured it. The window preview killed its capture helper
right after a frame when the target changed or the preview stopped, so
replayd failed to resolve it ("Error resolving binary path and audit
token"), showed the consent alert again and kept no answer.

Stopping the preview now ends the helper's input. The helper finishes the
outstanding frame and exits one second after its last one; SIGKILL is
only a fallback after 4 s. Callers no longer wait for the helper to exit.

Fixes: #1284

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@nixuuu
nixuuu enabled auto-merge (squash) November 29, 2026 08:01
@nixuuu
nixuuu merged commit df5c7f2 into dev Nov 29, 2026
24 checks passed
@nixuuu
nixuuu deleted the fix/macos-capture-graceful-exit branch November 29, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant