Skip to content

fix(computer-use): align the helper bundle identity with the app bundle id - #12

Merged
nplez1 merged 1 commit into
nplez1/mainfrom
nplez1/Computer-Use-Identity
Sep 21, 2026
Merged

nplez1 merged 1 commit into
nplez1/mainfrom
nplez1/Computer-Use-Identity

Conversation

@nplez1

@nplez1 nplez1 commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​137 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​137
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54 $\color{#cf222e}{\Huge{\mathbf{−}}}$​10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​44

ELI5

This app has two pieces: the app itself, and a small helper app it uses to click and read other
apps' windows. When the fork was renamed so it could install next to the official Orca, the helper
kept some of the old names inside it. macOS ties screen-recording and accessibility permission to
the helper's name, so a machine that had already granted permission kept the grant filed under the
old name, was asked again as if the helper were brand new, and had no way to clear the old entry.
The app also refused to talk to its own helper, because the helper's list of "apps I trust" didn't
include the app's new name. This PR gives the helper one name, used everywhere, so both problems go
away.

What Changed

Before. A build ran with two identities at once. The helper app bundle was
com.nplez1.orca.computer-use, but inside the helper the trust list, the three background queue
labels, and the TypeScript fallback used by the in-app "reset permissions" action all still named
com.stablyai.orca.computer-use. So:

  • granting permission produced a prompt for a bundle id macOS had never seen;
  • the stale grant from the pre-rename helper stayed filed under the old id, and the app's own reset
    restored only the id it could read from the current helper's Info.plist — falling back to the
    old id when that read failed, i.e. resetting the wrong app's grants;
  • computer use did not work at all: the transport always launches the helper with
    --agent … --token-file, and handleRequest returns
    permission_denied: computer-use agent peer is not authorized whenever a token is present and the
    peer is not in the trust list.

After. One identity per language, each pinned by a test:

Where Change
src/main/computer/macos-computer-use-permissions.ts the fallback id is derived from ORCA_APP_ID instead of a literal
native/computer-use-macos/Sources/OrcaComputerUseMacOSCore/OrcaBundleIdentity.swift new; the single Swift source for the app id, the dev bundle id, and the helper id
…/OrcaComputerUseMacOS/main.swift isTrustedOrcaApplication delegates to OrcaBundleIdentity.isTrustedPeer
…/PermissionStatusSnapshot.swift, …/AuthenticatedConnectionHangupMonitor.swift the three queue labels derive from the same constant
config/scripts/computer-use-bundle-identity.mjs new; holds the helper id and display name for the build script, which is CJS and cannot import the TypeScript constant
config/scripts/computer-use-bundle-identity.test.mjs new; pins that constant to ORCA_APP_ID and fails if any helper source names the pre-rename id again

com.github.Electron stays in the trust list: an unpackaged run (_electron.launch, bare
electron .) is the stock Electron binary and is not Orca-named.

Why

macOS anchors Accessibility and Screen Recording grants to a bundle id, so a bundle id that changes
once is a one-time re-prompt — but a helper that carries two ids, with a reset path that can only
reach one of them, leaves a state the user cannot clear from the app.

Why derive rather than hardcode: the helper id is always ${appId}.computer-use, and the two ids
had already drifted once. The TypeScript side now derives from ORCA_APP_ID; the Swift side reads a
single constant; the CJS build script reads a module pinned to ORCA_APP_ID by a test, which is the
same arrangement productName and the dev bundle identity already use. Alternatives considered:
one shared JSON file all three languages read (the Swift and CJS build steps would both need a
generated artifact, which is more machinery than two constants and one pin), and leaving the CJS
literal alone (it is exactly the value that drifted).

Why the trust list is not "prefix-match anything Orca-shaped": it authorizes a peer to drive this
helper's socket. It keeps the existing exact-id shape, extended to the ids this fork actually ships:
com.nplez1.orca, com.nplez1.orca.dev and its .dev. family (per-worktree wrapper and helper
bundles), plus com.github.Electron.

Linked Issue

Fixes # — no issue filed; found while auditing whether the packaged appId is consistent after the
"Orca NP" rename. Say the word and I will file one and link it.

Visual Proof

N/A — no UI or interaction change. The user-visible effect is one extra permission prompt on a
machine whose grant predates the rename, and computer use starting to work.

Testing

Automated:

  • npx vitest run src/main/computer/macos-computer-use-permissions.test.ts config/scripts/computer-use-bundle-identity.test.mjs config/scripts/computer-use-smoke.test.mjs config/scripts/computer-use-modifier-safety.test.mjs config/scripts/computer-use-mouse-button-routing.test.mjs — 5 files, 24 tests pass. The new TS test covers the previously untested fallback path (unreadable helper Info.plist) and asserts the reset targets this install's own id.
  • pnpm run tc:node, pnpm run check:code-quality:changed, pnpm run audit:code-quality:native, pnpm run check:max-lines-ratchet — clean.
  • swift build --package-path native/computer-use-macos — clean.
  • pnpm build:computer-macos then codesign -dv — Identifier=com.nplez1.orca.computer-use, signature valid.

Not verified on this machine: swift test --package-path native/computer-use-macos cannot run
here — it fails with no such module 'XCTest' (Command Line Tools only, no /Applications/Xcode.app),
and it fails that way on pre-existing test files too. So the new
Tests/OrcaComputerUseMacOSTests/OrcaBundleIdentityTests.swift is unverified locally and needs the
darwin runner in CI (config/scripts/verify-computer-native.mjs).

To reproduce by hand: on a machine whose helper was built before this change, note that
System Settings → Privacy & Security → Screen Recording lists the old helper id; after rebuilding
the helper the app prompts once under com.nplez1.orca.computer-use. The pre-rename grant is not
cleared by the app, because this change stops it from targeting that id at all.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

Claude (Pi coding agent) wrote the change under my direction; I reviewed the diff and ran the gates
above.

Review

Left for the reviewer.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: the trust list is the security-relevant part. It still requires an exact bundle id
    or a .dev.-family prefix under this fork's own reverse-DNS namespace, and it remains an
    additional gate on top of the per-session token, so this change does not weaken the peer check —
    it restores it for this fork's own app, which was previously rejected.
  • Cross-platform: macOS-only files. Windows and Linux computer-use providers are untouched.
  • Remote SSH: unaffected; the helper is local to the machine driving it.
  • Mobile: unaffected.
  • Backwards compatibility: a machine whose grant predates the rename re-prompts once and, if it
    wants the old rows gone, clears them with
    tccutil reset Accessibility com.stablyai.orca.computer-use and
    tccutil reset ScreenCapture com.stablyai.orca.computer-use. Nothing else changes: the URL scheme,
    userData, CLI names and ~/.orca-np are untouched.
  • Performance: no runtime cost; the identity constants are compile-time.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred) — targeted files and tc:node pass; full pnpm lint and pnpm test not run here

…le id

Fork-scoped: replaces the pre-rename `com.stablyai.orca` ids with this install's own namespace, so
it is not an upstream candidate.

The bundle rename changed the packaged helper's bundle id but missed every use of it inside the
helper and its permission plumbing, so a build ran with two identities at once: the app bundle was
com.nplez1.orca.computer-use, while the peer trust check accepted only com.stablyai.orca,
com.stablyai.orca.dev.* and com.github.Electron, and the TCC reset fallback and the three queue
labels still named the stablyai helper.

macOS anchors the helper's Accessibility and Screen Recording grants to its bundle id. A machine
that granted before the rename therefore kept its grants under the old id, saw a prompt for a
bundle it had never granted, and could not clear the stale rows from the app: the reset path reads
the current helper's Info.plist and only fell back to the old literal. The trust list is the
sharper end — the transport always launches the helper with --agent --token-file, and handleRequest
fails closed when a token is present and the peer is untrusted, so the fork's own app was rejected
as an unauthorized computer-use peer.

One identity per language now, each pinned by a test:
- src/main/computer/macos-computer-use-permissions.ts derives the helper id from ORCA_APP_ID.
- OrcaBundleIdentity owns the Swift-side ids for the trust list and the queue labels.
- COMPUTER_USE_BUNDLE_ID in config/scripts/computer-use-bundle-identity.mjs feeds the build
  script's Info.plist, which is CJS and cannot import the TypeScript constant.
- computer-use-bundle-identity.test.mjs pins that constant to ORCA_APP_ID and fails if any helper
  source names the pre-rename id again, so the next missed site cannot ship silently.

Tests: vitest over the permission and computer-use suites, tsc -p config/tsconfig.node.json,
oxlint and the changed-code quality gate. swift build is clean; swift test cannot run on this
machine (Command Line Tools only, no XCTest), so the new OrcaBundleIdentityTests is unverified
here and needs CI's darwin runner.
@nplez1
nplez1 merged commit c2cf36e into nplez1/main Sep 21, 2026
61 of 63 checks passed
nplez1 added a commit that referenced this pull request Oct 17, 2026
…link

Review of the previous commit found two ways the repo choice could mislead.

`linkedIssue` and `linkedWorkItem` are separate slots and `linkedIssue` wins
(workspace-linked-issue.ts), so the number the pane renders can name an issue
while the work item is something else: a PR, a Linear task, or a different
number. The previous commit borrowed that item's repo unconditionally, so a
workspace created from PR #12 and later linked to issue #7 would have read #7
out of #12's repo. The repo is now borrowed only when the item is a GitHub
issue with the rendered number; anything else reads the workspace repo, which
is what it did before.

The silent fallback when the item's repo is not registered on this device is
gone. It restored the old read, resolving the same number in whatever project
the workspace repo happens to be — showing an unrelated issue is worse than the
unavailable state, and the failing RPC was a wasted round trip either way.

Tests: a PR, a different number and a Linear task each keep the workspace repo,
and an unregistered item repo renders unavailable without calling the lookup.

Left out of scope, noted on the PR: the workspace card still fetches
`linkedIssue` from the workspace repo (use-worktree-card-lifecycle-effects.ts),
so for these workspaces the pane loads while the card's decoration does not.
nplez1 added a commit that referenced this pull request Oct 17, 2026
…om (#126)

* fix(issue-pane): read the linked issue from the repo the item came from

A workspace created from a task on another host (or in another project) lives
in that project's repo there, while the issue stays in the repo the task was
listed from. The pane read the issue out of the workspace's repo and sent the
task source's repo id with it, so a paired client asked the workspace's host
for a repo id only the client knows: the host answered "repo_not_found" and the
pane showed "Couldn't load this GitHub issue" over a link that was intact.

Resolve the repo through the linked item first and fall back to the workspace's
repo when that row is not registered on this device. Folder workspaces already
resolved this way; every other workspace now shares the rule, so the repo path,
the repo id and the routing target all describe one repo.

Considered sending the workspace row's repo id to the host instead. That works
only while both machines hold the same repo: when they do not, the issue number
resolves against the other repo and the pane reads the wrong issue.

* review(issue-pane): borrow the item's repo only when the item is the link

Review of the previous commit found two ways the repo choice could mislead.

`linkedIssue` and `linkedWorkItem` are separate slots and `linkedIssue` wins
(workspace-linked-issue.ts), so the number the pane renders can name an issue
while the work item is something else: a PR, a Linear task, or a different
number. The previous commit borrowed that item's repo unconditionally, so a
workspace created from PR #12 and later linked to issue #7 would have read #7
out of #12's repo. The repo is now borrowed only when the item is a GitHub
issue with the rendered number; anything else reads the workspace repo, which
is what it did before.

The silent fallback when the item's repo is not registered on this device is
gone. It restored the old read, resolving the same number in whatever project
the workspace repo happens to be — showing an unrelated issue is worse than the
unavailable state, and the failing RPC was a wasted round trip either way.

Tests: a PR, a different number and a Linear task each keep the workspace repo,
and an unregistered item repo renders unavailable without calling the lookup.

Left out of scope, noted on the PR: the workspace card still fetches
`linkedIssue` from the workspace repo (use-worktree-card-lifecycle-effects.ts),
so for these workspaces the pane loads while the card's decoration does not.

* fix(linked-issue): read a linked issue in the repo that owns it, everywhere

The Issue pane read its link out of the workspace's repo and sent the task source's repo id
with it, so a workspace created from a task on another host asked that host for a repo id only
this device has: "Couldn't load this GitHub issue" over an intact link. The pane was fixed
first; the same mistake was still live in the sidebar card's issue decoration, in both refresh
sweeps, and in how a re-linked number was read.

`linked-issue-repo.ts` now owns the rule once, and every surface calls it: the repo is the one
the work item came from when that item is this link, else the workspace's own repo. That
covers the sidebar card's cache key and fetch, the two refresh sweeps that key the same entry,
and the pane. `issueRepo` is threaded through the card lifecycle effects beside `repo` rather
than replacing it: PR and checks surfaces are about this workspace's git repo, not its issue.

Two things made the read incoherent beyond the repo choice:

- A creation-time source context can name a different repo than the row being read. Passing it
  along is what asked another host for a foreign repo id, so the pane now forwards it only when
  it names the row's own repo — consistent by construction, and still carries the account
  otherwise.
- A link that names a repo this device does not have rendered "Couldn't load this GitHub issue"
  and retried a read that cannot succeed. It now says so: `IssuePaneMessage` gains a
  `repoOffDevice` state, and there is no fallback to the workspace repo, because the same number
  in another project is a different issue.

The link editor stays scoped to the workspace repo, documented at the call site: it writes a
bare number, which displaces the work item, and the pane then reads that number in the
workspace repo — where the picker listed it.

Tests: a pure suite for the shared rule (all four identity cases, missing row, absent slice);
the card's issue cache key in three shapes; the pane's off-device copy and both source-context
guards. `pnpm tc:web`, oxlint, oxfmt, the changed-code gate and the localization catalog verify
are clean, and 1426 renderer suite files pass.

* fix(linked-issue): settle the card when the issue's repo is not on this device

The card's issue decoration is driven by a cache entry the review details key from the link's
repo. When that repo is not registered here there is no key, so the entry is `undefined`, which
the presentation reads as "still loading" — the card spun on a fetch that can never be made,
while the pane said the repo is missing. Before the repo moved to the link's repo this case
still ended in a failed fetch that cached `null`, so at least it settled.

`useWorktreeCardReviewDetails` now reports `issueRepoIsOffDevice` beside the entry, and the
presentation settles that link as unavailable. Two tests pin the settled and loading titles,
because the absent-entry case is exactly what the old code could not distinguish.

Also from the same review: the `readSourceContext` comment claimed it preserves the read's
account, which nothing selects from a source context — it scopes the cache and the host guard,
and the comment now says that. Dropped a duplicated cross-host pane test left over from the
previous pass.

* fix(linked-issue): cover both sweep paths and keep them linear in repo identity reads

The activation sweep (`refreshGitHubForWorktree`) still keyed and refetched a linked issue
through the workspace repo; only the full sweep had moved to the link's repo, so after a push
one path invalidated an entry the card never reads and refetched through the wrong repo.

Resolving the link's repo also has to stay off the O(N*M) path the sweep budget pins: an array
scan per worktree re-reads every repo row on every lookup. `findLinkedIssueRepo` now goes
through the store's memoised repo lookup index, which is what the sweep already builds, so the
pane, the card and both sweeps share one resolver and one pass.

Tests: the full sweep reads a cross-repo link from the item's repo, skips one that names a repo
this device does not have, and the existing identity-read budget test still holds.
@nplez1
nplez1 deleted the nplez1/Computer-Use-Identity branch October 24, 2026 03:23
nplez1 added a commit that referenced this pull request Nov 1, 2026
… Source Control (#267)

* feat(right-sidebar): pick between a workspace's reviews in Checks and Source Control

A workspace can hold several review attachments while its compatibility slots
name only one active review, and both panes only ever showed that one. The
Checks pane's review number and the Source Control header's review link are now
split controls: the link keeps opening the review, and a chevron lists every
review the workspace holds (`PR #12` / `MR !7`, with the title) and switches
which one the pane describes.

Switching drives the panes' reads, not just their labels:

- Checks re-reads checks, comments and review metadata for the picked review's
  number, drops the previous review's rows while that read is in flight, and
  maps the review onto the PR shape the pane already keys its head-sha
  freshness gate and comment actions on.
- Source Control's header link, review actions and compare base follow the
  pick. The file list, commit area, push target and PR creation keep resolving
  through the workspace's own review: pointing those at another branch's
  review would retarget a push.

The selection is the panes' view, not the workspace's link. It lives in the
fork's session-only renderer slice, keyed by worktree and shared between the
two panes so they cannot disagree, and never moves `linkedPR` — that slot is
what push-target and PR-creation safety resolve through. It is keyed on
provider and number rather than the attachment key, which moves when a
background refresh fills in a title or URL.

Unlinking now removes the review the switcher shows instead of the workspace's
slot, so it cannot unlink the review the user is not looking at. A picked
review is read through its own hosted-review cache key, so switching does not
overwrite the branch's review entry, and the Checks Refresh button refreshes
the picked review rather than the branch's.

* fix(right-sidebar): close the two blockers the review found in the review switcher

Round 1 (Opus 5.5, high) found two blocking defects and six should-fix items.

The first blocker: the Checks pane's Refresh took its number from any picked review,
so a picked GitLab MR sent `!7` to GitHub as PR #7 and a picked Bitbucket PR reused the
branch PR's head. The picked path now branches on the provider the pane actually
renders — GitHub checks and comments for a GitHub review, `fetchGitLabDetails` for an
MR, and the branch path for anything this pane cannot render.

The second: both panes cleared the shared pick whenever their own default matched it.
Their defaults come from different async sources, so a transient null in one pane wiped
the other's pick. Nothing writes the selection from a derived condition any more; the
selection's flag stays a per-pane render decision, and a stored key that names another
pane's default is simply that pane's default.

Should-fix items closed:

- The Checks switcher lists only reviews this pane can render, and its checked row is
  the review the header shows, so a listed row is never a review that is not on screen.
- Every "is a pick shown" decision reads the same value: the PR-check fetch no longer
  passes this worktree's branch for a picked review, which had been writing another
  PR's check status onto this branch's cached PR.
- Refresh-after-mutation and the entry refresh follow the pick; the triage strip's
  worktree-acting AI actions are hidden for a pick, because they start an agent in
  *this* worktree and would fix another branch's checks by committing here.
- Unlinking removes the row that carries the shown review and tombstones a GitHub one,
  so a slot-only clear cannot leave the review behind, and a failed update now reports.
- The selection is memoized, rows clear with a loading state, and the Refresh of a pick
  keys its results on the refreshed head instead of discarding them.

Tests cover the decision everything downstream reads (`shown-review.test.ts`), both
provider branches of a picked Refresh, the picked unlink, the header with a pick, and
that the hook never writes the shared selection on its own.

* fix(right-sidebar): close what the delta re-check found, including one regression of its own

The delta review (Opus 5.5, high) confirmed both round-1 blockers resolved and found
one blocker and three should-fix defects introduced by those fixes.

The blocker: the picked Refresh's staleness guard compared `asyncResultKeyRef.current`
with itself, which always passes, so a switch mid-flight wrote the old pick's rows
under the new review's header. The key is now captured locally, assigned to the ref,
and compared as a local — and the loading flags are cleared only by the request that
still owns them.

Should-fix items closed:

- `findWorkspaceReviewAttachment` matched issues too. A GitLab issue and an MR have
  separate number spaces, so unlinking `!42` could remove the issue `#42`; the search
  is filtered to review attachments, with a test that shares a number.
- Unlinking a picked GitHub review overwrote the `suppressedGitHubPR` tombstone of a
  branch PR the user had already unlinked, letting that PR come back. The tombstone is
  written only for the workspace's own review, which is the only one the branch lookup
  can resolve.
- The row-clear effect raised the loading flags on mount and on every return to the
  workspace review, where nothing guarantees a matching clear. It now runs on a switch
  only, and raises the flags only for a pick.

Minor items closed: the shared pick is cleared only when it names the review being
unlinked; Unlink is disabled again for a review with no row and no slot, whose unlink
would do nothing; the switcher never checks a row the header is not showing, in either
pane; a picked GitHub read no longer clears this branch PR's refresh error; and a
picked MR is re-read on tab entry and after a mutation, like the branch path.

Two round-1 gaps in coverage are also closed: the picked Refresh's guard is now
exercised with a real comparison and a mid-flight switch, and the polling path is
pinned to pass no branch for a pick.

* fix(right-sidebar): stop a mid-refresh switch from claiming the next review's result key

Round 3 (Opus 5.5, high, on the R2..R3 delta) confirmed eight of the nine round-2
findings resolved and found that N1 was only half-closed.

The remaining hole: after `refreshSelectedReview()` resolved, the picked Refresh only
checked `isCurrentRequest()`, which a review switch does not invalidate. It then claimed
`asyncResultKeyRef.current` with the *old* pick's key, so the old review's rows landed
under the new header and the new review's own in-flight read was discarded. The GitLab
sub-path had the same shape, passing no currency predicate to `fetchGitLabDetails`.

The fix answers "is this still the review on screen" from the stored selection rather
than the result key: the result key cannot tell a switch from the refreshed review
landing with a new head, which is the refresh working. Both the claim and the loading
flags now sit behind that check, while the refresh latch stays on the request alone so
it is always released.

Also closed: a pick whose row no longer matches no longer falls through to the branch
slot path, which would have addressed a review that is not on screen (and could write
the pick's number over an earlier branch-PR tombstone); the duplicate dependency in the
entry-refresh hook; and the redundant provider guard, now that
`findWorkspaceReviewAttachment` returns the narrowed attachment type.

Coverage added for the round-2 items that had none: a switch inside
`refreshSelectedReview`, an issue and an MR sharing a number with no URLs (asserting the
issue survives the removal), no tombstone written for a pick, no slot path for a pick
with no row, and no branch-PR error retraction from a picked read.

* test(right-sidebar): make the picked-refresh and picked-unlink assertions able to fail

Round 4 (Opus 5.5, high, on the R3..R4 delta) came back clean: no blockers, no
should-fix, and all seven round-3 findings resolved. Its three NITs were all about
tests that could not fail, so they are worth closing even though a NIT never blocks.

- The tombstone assertion used `expect.not.objectContaining({ suppressedGitHubPR:
  expect.anything() })`, which passes for a write of `suppressedGitHubPR: null` —
  exactly the write that would clear an earlier branch-PR tombstone and let that PR
  come back. It now asserts the key's absence.
- The mid-refresh-switch test now also pins that the result key was never claimed and
  that the refresh latch was released; a regression gating the latch on the pick check
  would have left Refresh disabled for good with no test failing. A second case switches
  the selection after the key was claimed, so the post-read pick check has its own test
  instead of relying on the result-key half.
- The issue/MR number-collision test moved to the GitLab unlink block, where it belongs,
  and its comment was wrong.

Both new guards were checked against their own absence: removing the post-read pick
check fails the claimed-key test, and removing the pick-with-no-row guard fails the
no-row test. The issue/MR test already discriminated, since the removal is keyed on an
attachment identity that folds in the type.

One round-4 assumption was checked and left alone: the GitLab details path clears its
loading flags on an abandoned request, which looks like the round-3 flags bug but is
deliberate — a generation counter keeps it off a newer request, and an upstream test
pins that an abandoned relink must release them or the pane keeps a spinner forever.
Adding a currency guard there broke that test, so the change was reverted rather than
the contract.
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