fix(cua-driver-rs)(macos): don't raise a terminal-attributed TCC prompt from call check_permissions - #1760
Conversation
…pt from `call` `cua-driver call check_permissions` (prompt:true) raised the AX/Screen- Recording dialog in-process. Run from a terminal, macOS attributes that dialog to the *terminal* (LaunchServices' "responsible" process), not to com.trycua.driver — so the prompt reads e.g. "Terminal would like to control this computer" and the grant lands on the terminal, never on the driver. (#1491) When we're a bundle CLI spawned from a terminal (should_use_daemon_proxy) and no daemon is up to route through, degrade `check_permissions` to report-only (force prompt:false) and print the one launch that grants correctly: open -n -g -a CuaDriver --args serve which raises the dialog AS CuaDriver and stays alive while the user grants. We deliberately do NOT auto-spawn that daemon from `call`: a one-shot call shouldn't leave a background daemon behind, and the first-launch permissions gate can lag socket creation (spawning on every call piled up zombie daemons + re-prompted in a loop). The `mcp` path is unchanged — it already routes through a LaunchServices- launched daemon (run_mcp_via_daemon_proxy), so its prompts already attribute to CuaDriver. Verified: from a terminal, `call check_permissions` now reports status + the grant hint with no prompt and no spawned daemon; `open -n -g -a CuaDriver --args serve` raises the correctly-attributed dialog and serves.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughOn macOS, the CLI now conditionally rewrites JSON arguments for the ChangesmacOS check_permissions prompt conditional rewrite
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem (observed live)
cua-driver call check_permissions(defaultprompt:true) raised the AX / Screen-Recording dialog in-process. Run from a terminal, macOS attributes that dialog to the terminal (LaunchServices' "responsible" process), not tocom.trycua.driver— so the prompt reads "Terminal/Gumbranch would like to control this computer" and the grant lands on the terminal, never on the driver. The user then "keeps getting asked for permissions despite having granted" because the grant went to the wrong app. (#1491)Fix
When we're a bundle CLI spawned from a terminal (
should_use_daemon_proxy) and no daemon is up to route through, degradecheck_permissionsto report-only (forceprompt:false) and print the one launch that grants correctly:which raises the dialog as CuaDriver and stays alive while the user grants.
Deliberately no auto-spawn from
call: a first attempt auto-launched that daemon on everycall, but the first-launch permissions gate lags socket creation, solaunch_daemon_and_waittimed out, fell back to an in-process (terminal) prompt, andopen -npiled up zombie daemons that re-prompted in a loop. Report-only + guidance avoids all of that.The
mcppath is unchanged — it already routes through a LaunchServices-launched daemon (run_mcp_via_daemon_proxy), so its prompts already attribute to CuaDriver.Depends on
/Applications/CuaDriver.app) — without the bundle there's nothing to attribute to.Known separate issue (not fixed here)
servelaunched viaopen -n -g -a CuaDriver --args servelags socket creation on first launch (the permissions gate's re-exec cycle), while terminal-foregroundserveis instant. Filing separately — it's why the auto-spawn approach was abandoned and is the remaining rough edge in the grant flow.Verified
call check_permissionsreports status + the grant hint, raises no prompt, spawns no daemon (regression gone).open -n -g -a CuaDriver --args servelaunches the daemon from the bundle (ppid=1) → prompts attribute tocom.trycua.driver.🤖 Generated with Claude Code
Summary by CodeRabbit