Skip to content

fix(desktop): allow desktop-launched Computer Use to send Apple Events - #7000

Merged
ymichael merged 3 commits into
get-bb:mainfrom
smsunarto:scott/computer-use-cleanup
Nov 4, 2026
Merged

ymichael merged 3 commits into
get-bb:mainfrom
smsunarto:scott/computer-use-cleanup

Conversation

@smsunarto

@smsunarto smsunarto commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

The signed macOS desktop app is hardened but did not have the com.apple.security.automation.apple-events entitlement or an NSAppleEventsUsageDescription. When the desktop app launches the bb server and host daemon, macOS treats bb.app as the responsible process for everything they spawn, including agents' Computer Use helpers. Every Apple Event those helpers send is therefore checked against bb's signature, and TCC refuses them without prompting: AccessRequestIndirect: Policy disallows prompt for dev.bb.desktop; access to kTCCServiceAppleEvents denied. The most visible case is the event Codex's turn-ended notifier sends to Codex Computer Use, which leaves the Computer Use cursor on screen after the turn ends (#2368).

What changed

  • apps/desktop/build/entitlements.mac.plist: add com.apple.security.automation.apple-events (main executable only).
  • apps/desktop/electron-builder.config.json: add NSAppleEventsUsageDescription to mac.extendInfo.
  • apps/desktop/test/electron-builder-config.test.ts: regression tests for both.

Agents launched from the desktop app can now request Automation access. macOS still asks the user once per target app ("bb wants to control Codex Computer Use"). A denied request can be changed in System Settings > Privacy & Security > Automation. Codex.app ships the same entitlement.

Scope: this only covers hosts the packaged desktop app starts. Host daemons running as LaunchAgents under a separate Node executable are attributed to that executable, so this change does not affect them (#6730).

How you verified

  • Rebased onto main. pnpm exec turbo run test --filter=@bb/desktop -- test/electron-builder-config.test.ts passes, 25/25. The two new tests fail without the change.
  • Built a Developer ID-signed, notarized QA build of this branch with the Build Desktop workflow (publish=false). It is hardened and has the entitlement and usage string.
  • A/B test on an Apple M5 running macOS 26.6.2. Both builds were bb 0.48.1, bundle id dev.bb.desktop, with the same signing team. Each ran with its own new data dir and was started from the desktop app, so bb.app was the responsible process. Each ran a Codex thread that used Computer Use in Calculator. I reset the Apple Events permission before each run and sampled on-screen Computer Use windows every 0.5 s:
Stable 0.48.1 (no fix) This PR
turn-ended Apple Event Policy disallows prompt for dev.bb.desktop; ... denied TCC RESULT: ... ACCESS GRANTED
Computer Use cursor after the turn Still fully visible 30 s later Faded ~0.5 s after the event; gone ~1 s after the turn ended
  • On the PR build, the first Apple Event prompted "bb wants to control Codex Computer Use" with the usage string. The QA build showed the earlier wording; the final commit changes it to "bb lets agents you run control other apps on this Mac, such as Computer Use." After Allow, nothing prompted again. Cleanup events were allowed at the end of four completed turns in the same thread, including a turn after an interrupt.
  • Interrupting a turn (bb thread stop): Codex does not send turn-ended for interrupted turns, so no Apple Event was sent. Stopping released the Codex runtime, and the Computer Use service exited with it. Window samples were not taken for the interrupt.

Fixes #2368

Related: #6730 (LaunchAgent / Node-daemon hosts are not covered by this change).

AGENT GENERATED

🤖 Generated with Claude Code

@github-actions github-actions Bot added the needs-issue PR does not close an open issue label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for the pull request, @smsunarto. It was closed automatically because it does not meet the requirements below yet. This is an automated check, not a review of the change.

Linked issue. Every pull request must close an open issue in this repository. The issue keeps the problem tracked even if this pull request closes or we take a different approach. Open an issue for the change, or find an existing one, and add Fixes #<number> to the pull request description. Feature requests and UI changes need a maintainer's sign-off on the issue first. This pull request reopens on its own once you save the description.

See CONTRIBUTING.md for details.

@github-actions github-actions Bot closed this Nov 4, 2026
@github-actions github-actions Bot removed the needs-issue PR does not close an open issue label Nov 4, 2026
@github-actions github-actions Bot reopened this Nov 4, 2026
@smsunarto
smsunarto marked this pull request as ready for review November 4, 2026 04:50
ymichael added a commit that referenced this pull request Nov 4, 2026
## Human comments

## What was wrong

bb showed PR #7000 as "failing (22 passed, 4 failed)" while GitHub's
commit rollup was `SUCCESS` and the PR was `CLEAN`. Every workflow had
run twice on the head commit, both from `pull_request` events about a
second apart. Concurrency cancelled CI run #20437, and its replacement,
#20438, passed. GitHub's rollup only counts the newest run. bb rebuilt
the check state from individual check runs and merged duplicates by name
only. Four cancelled matrix jobs from the old run never expanded their
names (for example `Tests (${{ matrix.shard }}, ubuntu-latest, Node
22.x)`), so no check in the new run shared their names, and bb counted
them as failures. `gh pr checks` merges by name too and shows the same
four failures.

A second path had the same problem. When bb can't resolve the GitHub
repository from git remotes, it found the PR with `gh pr view`. For
drafts, closed PRs and failed GraphQL reads, it then used `gh`'s own
`statusCheckRollup`, which has no workflow-run data.

## What changed

`plugins/github-pr-status/host/git-host.ts`:

- The GraphQL check query now fetches each check run's
`checkSuite.workflowRun` (run number, event, workflow ID). After all
check pages are merged, bb drops checks from any run superseded by a
newer run of the same workflow and event. Runs for different events,
such as `push` and `pull_request`, are both kept, so a real failure is
not hidden. Status contexts and non-Actions check runs are unchanged.
- The `gh pr view` discovery path now asks only for `--json url`, then
reads the PR through the same GraphQL URL read every refresh uses. This
now includes drafts and closed PRs. If that read fails, bb reports the
PR as unavailable, which keeps any previous snapshot, instead of
returning a partial PR. The `gh pr view` field list, its parser, and the
`gh`-only parsing branches (array `reviewRequests`, `workflowName`
fallback) are removed.

This is host-local to the plugin. The host/server contract and
`HOST_DAEMON_PROTOCOL_VERSION` are unchanged.

## How you verified

- Added tests:
- batch tests for a superseded run on one check page and for a newer run
on a later page;
  - a discovery-path test for a draft with a superseded run;
  - a GraphQL-shaped normalization test;
  - unavailable cases for invalid or failed GraphQL responses.

The superseded-run tests failed against the first draft of the fix,
because the zod parse clones the check objects and dropped the run tags,
so they do catch the bug.
- `pnpm exec turbo run test typecheck lint
--filter=bb-plugin-bb--github-pr-status`: 174 tests pass, plus typecheck
and lint.
- Read live #7000 with the patched host code: `passing`, 22/22,
`ready_to_merge`.
- Ran `pnpm start:worktree` with a checkout of #7000's branch as a
project. `bb pull-request show` reports checks passing 22/22,
`CLEAN`/`MERGEABLE`, `ready_to_merge`. Production bb on the same PR
reports `failing (22 passed, 4 failed, 26 total)`, `checks_failed`.
- Not exercised live: the discovery path for unresolvable remotes. It is
covered by unit tests only.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the scott/computer-use-cleanup branch from 9ace346 to 2e93787 Compare November 4, 2026 20:30
@ymichael ymichael changed the title fix(desktop): allow computer-use cleanup Apple Events fix(desktop): allow desktop-launched Computer Use to send Apple Events Nov 4, 2026
@ymichael
ymichael merged commit 91a36d9 into get-bb:main Nov 4, 2026
23 checks passed
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.

macOS app lacks Apple Events entitlement, blocking Computer Use child tools

3 participants