Skip to content

fix(computer): a macOS app granted screen capture is approved ahead by its bundle's file URL too - #560

Merged
earakely-scale merged 4 commits into
mainfrom
edgararakelyan/fd-5358-macos-app-capture-approval
Nov 9, 2026
Merged

earakely-scale merged 4 commits into
mainfrom
edgararakelyan/fd-5358-macos-app-capture-approval

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

On a macOS computer, an app granted screen_capture still showed macOS's prompt "'X' is requesting to bypass the system private window picker and directly access your screen and audio" on its first direct capture. In the background, that prompt takes the user's key focus, so every background trial whose driver captures through its own helper app fails the bench's user_undisturbed criteria.

lib.sh's grant writes the TCC row and records an approval in ScreenCaptureApprovals.plist ahead of time. The approval was missing two things:

  • The key macOS checks for an app. That's the bundle's file URL, such as file:///opt/agentenv/codex-computer-use/Codex%20Computer%20Use.app/. The grant wrote only the bundle identifier.
  • A privacy hint. macOS hints again once kScreenCapturePrivacyHintDate passes, and the grant never set one.

Now a screen capture grant records the approval under the client TCC knows the program by, and for an app under its bundle's file URL too. Each entry sets kScreenCapturePrivacyHintDate and kScreenCapturePrivacyHintPolicy as far off as the approval. Executables keep a single key, their path.

How the key was found. In a composed macos-26 computer with codex-computer-use on our Mac host:

  • before the prompt, ScreenCaptureApprovals.plist held com.openai.sky.CUAService with only LastAlerted and LastUsed;
  • accepting the prompt made macOS write file:///opt/agentenv/codex-computer-use/Codex%20Computer%20Use.app/ with kScreenCapturePrivacyHintDate and kScreenCapturePrivacyHintPolicy (30 days);
  • the entries Cua's base image writes for its own agents carry both fields, at 100 years.

Cua Driver Bench's Codex Computer Use arm (earakely-scale/agentenv-cua-driver-bench#1) hit this in its smoke trials: its background trials failed key_focus, window_raised, typing and activation while their tasks passed.

The VM bundle's compose key covers lib.sh's folder, so existing composed computers compose afresh with the fix.

Testing

  • Unit: tst/unit/env/envs/test_computer_macos_grants.py sources lib.sh in bash with macOS's tools stood in for. An app's screen capture grant writes the approval under its identifier and its bundle's file URL, with the privacy hint. An executable's writes one, under its path. Other services write none. The file URL is written as Foundation's NSURL fileURLWithPath writes it: a test pins Foundation's table for every printable ASCII character, and a path past ASCII fails rather than writing a key macOS never reads. I checked the encoder against Foundation on macOS for all 95 characters under bash 3.2, the VM's bash, with no mismatch.
  • The env suite passes, apart from the Windows ISO test in test_disk_recipe.py, which fails the same way on main on macOS.
  • On our Mac hosts: Cua Driver Bench's Codex Computer Use arm ran all 40 of its background trials on this commit (90 trials in all, Sonnet 5.5).
    • Before the fix: both background smoke trials lost the user's key focus, typing and activation to the prompt.
    • On the fix: no trial showed the prompt. Most trials kept the user's key focus, typing and activation. The four that didn't lost them to GnuCash bringing itself to the front, not to a prompt.
    • What still fails is window_raised, from the apps' and Codex's own windows rising above the user's.
  • cua-driver unchanged. cua-driver is granted as an app too (/Applications/CuaDriver.app), so it gets the new key. I reran six of its published background trials (IR-01 to IR-03, runs 1 and 2) on this PR's head, Sonnet 5.5, on our Mac host:
    • 5 of 6 passed, with 6 of 6 tasks done and one window_raised failure.
    • That matches the published run on the old framework: 5 of 6, 6 of 6 tasks done, one window_raised failure, on a different trial.
    • key_focus, typing and activation held in every trial, as before.
    • So cua-driver wasn't hitting the prompt, and its board numbers stay comparable.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues remain.

Summary

Screen-capture grants now record approvals under an app’s identifier and bundle file URL, with matching privacy-hint fields.

  • Mac app screen-capture grants cover both approval keys.

Reviews (5) · Last reviewed commit: "test(computer): a bundle path past ASCII..." · Reviewed by Greptile

…y its bundle's file URL too

An app's first direct capture still asked "to bypass the system private window picker": macOS keys
that approval by the app's file URL, and hints again once kScreenCapturePrivacyHintDate passes, and
the grant wrote neither. In the background that prompt takes the user's focus, as Codex Computer
Use's helper did on Cua Driver Bench. The grant now records the approval under the file URL too,
with a privacy hint as far off as the approval, for every client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
earakely-scale and others added 3 commits November 9, 2026 08:15
…n as Foundation writes it

file_url percent-encoded every byte but letters, digits and "/._~-", where Foundation keeps
"!$&'()*+,:=@" as they are, and bash 3.2's printf wrote a byte past ASCII as %FFFFFFFFFFFFFFC3;
an app whose path held one was approved under a key macOS never reads, so it asked again. Now it
keeps Foundation's set, encodes every other printable ASCII character, and fails on any other byte,
since Foundation decomposes such a character first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale merged commit 0daaa55 into main Nov 9, 2026
35 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/fd-5358-macos-app-capture-approval branch November 9, 2026 16:38
earakely-scale added a commit to earakely-scale/agentenv-cua-driver-bench that referenced this pull request Nov 9, 2026
That release approves the driver's helper app's screen capture ahead under the key macOS reads
(scaleapi/agentenv-framework#560), so macOS's prompt to bypass the private window picker doesn't
take the user's focus in a background trial.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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