Repository navigation
fix(macos): explain the TCC prompts, and surface Full Disk Access only to users macOS is prompting (#9756) - #9910
Conversation
…pts (#9756) macOS shows the "Orca wants to access other apps' data" (kTCCServiceSystemPolicyAppData) prompt and it can keep reappearing. The reappearing loop is not a fixable app bug: it is TCC identity churn — an unsigned local rebuild mints a new code identity each build, so macOS treats each as a new app — and Orca's other-app reads are already gated behind opt-in settings or explicit user actions. The durable remedy for the population we can help (release users) is Full Disk Access, a superset macOS grant that stops these prompts for a stable identity. Surface it with an ambient, dismissable sidebar card that reuses the existing developer-permissions IPC. macOS-only; probes FDA status at most once per renderer session (the probe itself reads protected data, so it must not repeat on focus/remount); "Open System Settings" opens the Full Disk Access pane; permanent localStorage dismissal.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a macOS-only Full Disk Access sidebar nudge with one-time permission probing, session caching, focus-based refresh after opening System Settings, and persistent dismissal. Integrates the nudge into the sidebar and adds translations for English, Spanish, Japanese, Korean, and Chinese. Adds tests covering visibility, permission requests, errors, StrictMode probing, focus updates, caching, dismissal persistence, and storage failures. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/sidebar/FullDiskAccessNudge.test.tsx (1)
76-85: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winClear the mocked toast call history in
afterEach()vi.restoreAllMocks()won't reset thevi.fn()s created in thevi.mock('sonner', …)factory, sotoast.error/message/successcan leak call counts across tests. Addvi.clearAllMocks()here too.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 65b3efb3-d499-4778-ae62-ba6b58e39c70
📒 Files selected for processing (8)
src/renderer/src/components/sidebar/FullDiskAccessNudge.test.tsxsrc/renderer/src/components/sidebar/FullDiskAccessNudge.tsxsrc/renderer/src/components/sidebar/index.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.json
The card said Full Disk Access makes "macOS stop asking", but the grant covers this app while terminals are spawned by the detached PTY daemon (daemon-init.ts forks execPath with ELECTRON_RUN_AS_NODE + detached:true, reparented to launchd), which macOS treats as its own TCC identity. A user who followed the card would grant FDA and still be prompted from terminals. Scope the claim to reducing prompts and name the terminal caveat.
refreshFullDiskAccessStatus() applied whichever getStatus() round-trip resolved last. Rapid blur/focus puts several in flight, so an earlier pre-grant 'unknown' landing after a newer 'granted' un-hid the card and also wrote 'unknown' into the module-level session cache, re-nagging a user who already has Full Disk Access for the rest of the session. The adjacent FullDiskAccessSetupPrompt already guards this with a refresh sequence; mirror it here. Also unmount React roots in afterEach: clearing document.body left them mounted, leaking each test's window focus listener into later tests.
The afterEach unmount added in 5a0f717 only covers roots created through renderNudge(). The StrictMode probe test builds its own root, so it was never unmounted and its component stayed live for the rest of the file. Today that component has no window focus listener, so nothing breaks; add a CTA click to it and the same contamination 5a0f717 fixed comes back — the two tests after it see extra getStatus() calls and fail. Register the root so the fix covers every mount site.
…wn reads The card said the prompts happen "when this copy of Orca reads protected app data", but Orca's own reads are small and gated; #9756's trigger is agent find/grep sweeps into ~/Library/Containers, which macOS bills to Orca because Orca is the responsible process for every terminal child. Blaming Orca reads as an accusation and hid why FDA works at all — the grant attaches to Orca rather than to each churning child binary. Name agents as the trigger, keep the "reduce" hedge and the terminal caveat, and drop the "this copy of Orca" dev-build hedge that cost a clause. Assert the causation wording so it can't silently regress.
…ebar card The sidebar nudge added in 344d466 was premised on FDA being reachable "only inside onboarding". It isn't: Settings > macOS Permissions has had a full-disk-access row all along (searchable), the Setup Guide hosts the same prompt from both a settings pane and a re-openable modal, and the sidebar already links to that modal via the "Onboarding checklist" entry. The card added a fifth affordance to the same sidebar that already had the fourth, so it bought prominence rather than access - shown to every macOS user without FDA, most of whom never hit #9756. Keep the part that was actually new. The settings row still described the prompts as something projects and worktrees trigger, which is the same misattribution the card carried: the reads come from the agents Orca runs, and macOS names Orca only because it is the responsible process for every terminal child. It also never mentioned that the grant has to cover Orca Helper, or that the preserved daemon keeps stale TCC state until restart. Non-English catalogs get the English string as a placeholder; the bootstrap translators key their cache on the English value, so a changed string is re-translated on the next run.
The FDA hint is only worth showing to users macOS is actually prompting. tccd emits one AUTHREQ_PROMPTING line per consent dialog it displays, carrying the service and both identities, so a narrow log-stream predicate detects the real thing without correlating across lines or guessing whether a dialog appeared. Verified against a captured dialog: the predicate matched 1 line out of 1436 TCC lines in ~28s, because routine preflight checks - the overwhelming majority of TCC traffic - do not emit it. Count dialogs where Orca is the responsible process, persist across launches, and tell the renderer on the third one. The event separates the accessing binary from the responsible app, which is the crux of #9756, so the toast can name the tool that triggered it rather than blaming Orca generically. One toast per user, with a permanent opt-out; it deep-links to the FDA row in Settings > macOS Permissions rather than restating the guidance. macOS-only: the watcher no-ops elsewhere, the web client stubs the API, and the child is killed on before-quit since log stream ignores a closed stdout.
# Conflicts: # src/renderer/src/web/web-preload-api.ts
…arwin path start() is darwin-gated, so on Linux CI it no-opped and the stream/kill assertions passed vacuously against a watcher that never spawned. Pin process.platform per the existing convention (shared/secure-file.test.ts), and cover the gate itself with an explicit non-darwin case.
…wiring attachMainWindowServices is called directly by its own unit test, so wiring initTccPromptNotice there made `vitest src/main/window/` spawn real `log stream` children that outlived the run - two orphaned watchers were left behind by a single test session. Only the IPC handler registration stays there; the spawn moves to the real app bootstrap in index.ts, which tests never execute. Verified: running the suite that leaked now leaves the watcher count unchanged.
| return join(getCanonicalUserDataPath(), 'macos-tcc-prompt-tally.json') | ||
| } | ||
|
|
||
| function loadTally(): TccPromptTally { | ||
| try { |
There was a problem hiding this comment.
Test-only helpers exported from production module
handleTccPromptForTests and resetTccPromptNoticeForTests are exported from the production module and ship in the main-process bundle. Any code that imports from this module can call resetTccPromptNoticeForTests() and silently zero out the persisted tally or call handleTccPromptForTests() to advance it. The typical alternative is a test-only entry point (e.g., macos-tcc-prompt-notice.test-utils.ts) that re-exports internals via vi.importActual, or moving the mutable state behind a dependency-injected factory so tests inject fresh instances directly.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| } | ||
| const service = /\bservice=(kTCCService\w+)/.exec(line)?.[1] | ||
| const accessingIdentifier = /\bSub:\{([^}]*)\}/.exec(line)?.[1] | ||
| const responsibleIdentifier = /\bResp:\{TCCDProcess:\s*identifier=([^,}]+)/.exec(line)?.[1] | ||
| if (!service || !accessingIdentifier || !responsibleIdentifier) { | ||
| return null | ||
| } | ||
| const binaryPath = /\bbinary_path=([^,}]+)/.exec(line)?.[1] |
There was a problem hiding this comment.
binaryPath field is mislabelled and the ORCA_APPDATA_LINE fixture is internally inconsistent
The JSDoc for binaryPath says "Absolute path of the accessing binary", but the extraction regex (\bbinary_path=([^,}]+)) matches inside the Resp:{…} block — the responsible process's path. The fabricated ORCA_APPDATA_LINE fixture has identifier=com.stablyai.orca paired with binary_path=/opt/homebrew/Cellar/node/26.5.0/bin/node, placing node's binary path inside the Orca responsible-process block. A genuine capture would show Orca's own binary there. binaryPath is unused by isOrcaAttributedPrompt, so runtime behaviour is unaffected, but the field name and fixture can mislead future readers.
| /** True when this dialog is one macOS raised in Orca's name for a watched file-access service. */ | ||
| export function isOrcaAttributedPrompt(event: TccPromptEvent): boolean { | ||
| return ( |
There was a problem hiding this comment.
accessingIdentifier regex silently drops events if an identifier ever contains }
/\bSub:\{([^}]*)\}/ captures up to the first }, so a raw identifier containing a closing brace would produce a truncated value and could cause the event to be dropped (the outer guard requires all three fields to be non-empty). For every known TCC log line this is fine, but Apple can change the log format at any OS release. A null return is the correct degradation path and the existing "honest caveats" section already notes this risk.
Greptile SummaryThis PR replaces an always-on macOS FDA nudge with a threshold-gated toast that only appears after macOS has shown three TCC consent dialogs naming Orca as the responsible process, and corrects the settings-row copy to explain the real mechanism (agents and terminal tools trigger TCC; Orca is named because it owns the PTY).
Confidence Score: 4/5Safe to merge; the watcher is darwin-only, degrades silently on failure, and never gates any user-visible functionality. The core logic is well-designed and extensively tested. The findings are cosmetic: test helpers shipped in the production bundle, and a mislabelled binaryPath field paired with an internally inconsistent test fixture. Neither affects runtime behavior. Files Needing Attention: src/main/macos-tcc-prompt-watch.ts — binaryPath JSDoc and ORCA_APPDATA_LINE fixture inconsistency; src/main/macos-tcc-prompt-notice.ts — handleTccPromptForTests/resetTccPromptNoticeForTests exported into the production bundle.
|
| Filename | Overview |
|---|---|
| src/main/macos-tcc-prompt-watch.ts | New file: spawns log stream with a tight TCC predicate, parses AUTHREQ_PROMPTING lines, and filters for Orca-attributed dialogs. binaryPath field is mislabelled and the ORCA_APPDATA_LINE test fixture has a contradictory binary path. |
| src/main/macos-tcc-prompt-notice.ts | New file: manages tally persistence and push/pull delivery of the threshold notice. handleTccPromptForTests and resetTccPromptNoticeForTests ship in the production bundle. |
| src/main/window/attach-main-window-services.ts | Adds registerTccPromptNoticeHandlers: correctly scopes IPC handlers to the current main renderer via ownsNotice, handles renderer reload/crash, replaces handlers on re-attach, and cleans up on window close without disturbing newer handlers. |
| src/renderer/src/hooks/macos-tcc-prompt-notice-subscription.ts | New file: claim-based subscription with one display retry, StrictMode-safe cleanup, and graceful degradation when any IPC method is absent. |
| src/renderer/src/hooks/useMacosTccPromptNotice.ts | New hook: gates subscription on locale readiness to avoid blank-string toasts. |
| src/main/index.ts | Wires initTccPromptNotice after attachMainWindowServices and calls stopTccPromptNotice in both will-quit and process.once('exit') to cover app.exit() bypass. |
| src/preload/index.ts | Adds macosTccPrompts preload bridge with typed IPC wrappers for all five channels. |
| src/renderer/src/web/web-preload-api.ts | Stubs macosTccPrompts for the web client with no-ops. |
| config/scripts/run-electron-vite-dev.mjs | v6 to v7 bump forces dev bundle recreation; patches Electron Helper CFBundleIdentifier so the dev helper carries the watched com.stablyai.orca.dev.helper TCC identity. |
Sequence Diagram
sequenceDiagram
participant tccd as macOS tccd
participant log as log stream
participant watch as MacosTccPromptWatch
participant notice as TccPromptNotice (main)
participant ipc as IPC / preload
participant renderer as Renderer (React)
tccd->>log: emits AUTHREQ_PROMPTING line
log->>watch: stdout line
watch->>watch: parseTccPromptEvent() + isOrcaAttributedPrompt()
watch->>notice: onPrompt()
notice->>notice: recordPrompt() - promptCount++, saveTally()
alt "promptCount < threshold"
notice-->>watch: (silent)
else "promptCount == threshold"
notice->>ipc: webContents.send macosTccPrompts:threshold payload
notice->>watch: stopTccPromptNotice()
ipc->>renderer: onThreshold callback fires
renderer->>ipc: consumePending()
ipc->>notice: consumePendingTccPromptNotice(ownerToken)
renderer->>renderer: toast.warning() shown
renderer->>ipc: acknowledgePending(claimId)
ipc->>notice: "tally.notified=true, saveTally()"
end
note over renderer: User clicks Don't show again
renderer->>ipc: dismiss()
ipc->>notice: "dismissed=true, saveTally()"
Reviews (1): Last reviewed commit: "perf(macos): isolate TCC notice subscrip..." | Re-trigger Greptile
…y to users macOS is prompting (stablyai#9756) (stablyai#9910) * fix(macos): add a Full Disk Access nudge to reduce recurring TCC prompts (stablyai#9756) macOS shows the "Orca wants to access other apps' data" (kTCCServiceSystemPolicyAppData) prompt and it can keep reappearing. The reappearing loop is not a fixable app bug: it is TCC identity churn — an unsigned local rebuild mints a new code identity each build, so macOS treats each as a new app — and Orca's other-app reads are already gated behind opt-in settings or explicit user actions. The durable remedy for the population we can help (release users) is Full Disk Access, a superset macOS grant that stops these prompts for a stable identity. Surface it with an ambient, dismissable sidebar card that reuses the existing developer-permissions IPC. macOS-only; probes FDA status at most once per renderer session (the probe itself reads protected data, so it must not repeat on focus/remount); "Open System Settings" opens the Full Disk Access pane; permanent localStorage dismissal. * fix(macos): stop the FDA nudge promising macOS will stop asking The card said Full Disk Access makes "macOS stop asking", but the grant covers this app while terminals are spawned by the detached PTY daemon (daemon-init.ts forks execPath with ELECTRON_RUN_AS_NODE + detached:true, reparented to launchd), which macOS treats as its own TCC identity. A user who followed the card would grant FDA and still be prompted from terminals. Scope the claim to reducing prompts and name the terminal caveat. * fix(macos): drop stale focus refreshes in the FDA nudge refreshFullDiskAccessStatus() applied whichever getStatus() round-trip resolved last. Rapid blur/focus puts several in flight, so an earlier pre-grant 'unknown' landing after a newer 'granted' un-hid the card and also wrote 'unknown' into the module-level session cache, re-nagging a user who already has Full Disk Access for the rest of the session. The adjacent FullDiskAccessSetupPrompt already guards this with a refresh sequence; mirror it here. Also unmount React roots in afterEach: clearing document.body left them mounted, leaking each test's window focus listener into later tests. * test(macos): unmount the StrictMode FDA nudge root between tests The afterEach unmount added in 5a0f717 only covers roots created through renderNudge(). The StrictMode probe test builds its own root, so it was never unmounted and its component stayed live for the rest of the file. Today that component has no window focus listener, so nothing breaks; add a CTA click to it and the same contamination 5a0f717 fixed comes back — the two tests after it see extra getStatus() calls and fail. Register the root so the fix covers every mount site. * fix(macos): attribute the FDA prompts to agent activity, not Orca's own reads The card said the prompts happen "when this copy of Orca reads protected app data", but Orca's own reads are small and gated; stablyai#9756's trigger is agent find/grep sweeps into ~/Library/Containers, which macOS bills to Orca because Orca is the responsible process for every terminal child. Blaming Orca reads as an accusation and hid why FDA works at all — the grant attaches to Orca rather than to each churning child binary. Name agents as the trigger, keep the "reduce" hedge and the terminal caveat, and drop the "this copy of Orca" dev-build hedge that cost a clause. Assert the causation wording so it can't silently regress. * fix(macos): explain the TCC prompts on the settings row, drop the sidebar card The sidebar nudge added in 344d466 was premised on FDA being reachable "only inside onboarding". It isn't: Settings > macOS Permissions has had a full-disk-access row all along (searchable), the Setup Guide hosts the same prompt from both a settings pane and a re-openable modal, and the sidebar already links to that modal via the "Onboarding checklist" entry. The card added a fifth affordance to the same sidebar that already had the fourth, so it bought prominence rather than access - shown to every macOS user without FDA, most of whom never hit stablyai#9756. Keep the part that was actually new. The settings row still described the prompts as something projects and worktrees trigger, which is the same misattribution the card carried: the reads come from the agents Orca runs, and macOS names Orca only because it is the responsible process for every terminal child. It also never mentioned that the grant has to cover Orca Helper, or that the preserved daemon keeps stale TCC state until restart. Non-English catalogs get the English string as a placeholder; the bootstrap translators key their cache on the English value, so a changed string is re-translated on the next run. * feat(macos): nudge Full Disk Access only after macOS repeatedly prompts The FDA hint is only worth showing to users macOS is actually prompting. tccd emits one AUTHREQ_PROMPTING line per consent dialog it displays, carrying the service and both identities, so a narrow log-stream predicate detects the real thing without correlating across lines or guessing whether a dialog appeared. Verified against a captured dialog: the predicate matched 1 line out of 1436 TCC lines in ~28s, because routine preflight checks - the overwhelming majority of TCC traffic - do not emit it. Count dialogs where Orca is the responsible process, persist across launches, and tell the renderer on the third one. The event separates the accessing binary from the responsible app, which is the crux of stablyai#9756, so the toast can name the tool that triggered it rather than blaming Orca generically. One toast per user, with a permanent opt-out; it deep-links to the FDA row in Settings > macOS Permissions rather than restating the guidance. macOS-only: the watcher no-ops elsewhere, the web client stubs the API, and the child is killed on before-quit since log stream ignores a closed stdout. * test(macos): pin the platform so the TCC watcher tests exercise the darwin path start() is darwin-gated, so on Linux CI it no-opped and the stream/kill assertions passed vacuously against a watcher that never spawned. Pin process.platform per the existing convention (shared/secure-file.test.ts), and cover the gate itself with an explicit non-darwin case. * fix(macos): start the TCC watcher from app bootstrap, not the window wiring attachMainWindowServices is called directly by its own unit test, so wiring initTccPromptNotice there made `vitest src/main/window/` spawn real `log stream` children that outlived the run - two orphaned watchers were left behind by a single test session. Only the IPC handler registration stays there; the spawn moves to the real app bootstrap in index.ts, which tests never execute. Verified: running the suite that leaked now leaves the watcher count unchanged. * fix(macos): clarify repeated permission notice * fix(macos): keep TCC notice lifecycle safe * fix(macos): retain pending TCC notice delivery * fix(macos): acknowledge TCC notice delivery * fix(macos): release failed TCC notice claims * fix(macos): retry transient TCC notice display * fix(macos): contain TCC notice IPC failures * fix(macos): harden TCC notice renderer lifecycle * fix(macos): contain TCC notice dismissal failures * test(macos): satisfy promise executor lint * fix(macos): detect helper-attributed TCC prompts * fix(macos): align TCC watcher lifecycle and helper identity * perf(macos): defer TCC log reader until first paint * fix(macos): recover deferred TCC watcher startup * fix(macos): recover TCC watcher from deferred quit * fix(macos): localize recurring file access notice * fix(macos): preserve TCC watcher and localized guidance * fix(macos): avoid duplicate TCC watcher recovery * fix(macos): wait for locale before TCC notice * perf(macos): isolate TCC notice subscriptions --------- Co-authored-by: Brennan Benson <[email protected]>
Summary
macOS repeatedly shows "Orca" wants to access other apps' data (
kTCCServiceSystemPolicyAppData), and for some users it keeps coming back after Allow (#9756).The dialog names Orca, but Orca is rarely the thing reading anything. Agents and terminal commands do the access; TCC walks the responsibility chain back to the app that spawned the shell and puts Orca's name on the prompt. That mismatch is why the prompts feel inexplicable, and why "Allow" doesn't always stick — the grant is keyed to the accessing binary's identity, which churns every time an agent CLI updates.
This PR does two things: it explains that correctly where users already look, and it surfaces the Full Disk Access remedy only to users macOS is actually prompting.
What changed
1. The settings row now explains the real cause.
Settings → macOS Permissions → Full Disk Accesspreviously read "Recommended when projects, worktrees, or symlinked files touch macOS-protected folders" — which describes the rare case as the cause and never mentions the helper. It now attributes the prompts to the agents Orca runs, explains the responsible-process naming, and says the grant needs Orca Helper too plus a restart, because the preserved PTY daemon keeps stale TCC state.2. A threshold-gated notice.
tccdemits exactly oneAUTHREQ_PROMPTINGline per consent dialog it displays. A narrowlog streampredicate watches for those, counts the ones where Orca is the responsible process, persists the count across launches, and shows a single toast on the third. The toast deep-links to the settings row and can be permanently dismissed.The notice stays user-facing: it explains that macOS credits file access by agents and terminal tools to Orca, then points to Full Disk Access as the way to reduce repeated prompts.
3. No always-on nudge. An earlier revision of this PR added a permanent sidebar card for every macOS user without FDA. That's removed. Orca already had four ways to reach the FDA setting — the settings row (searchable), the Setup Guide pane, the Setup Guide modal, and the sidebar's own "Onboarding checklist" entry that opens that modal. A fifth affordance in the same sidebar bought prominence, not access, and pushed a broad system grant at users who never hit the bug.
Why detection is reliable
Verified against a real captured dialog rather than assumed:
AUTHREQ_CTX/AUTHREQ_ATTRIBUTION, which are split across lines joined bymsgID.preflight=yes), which dominate the subsystem, never emit it.The parser test uses the captured line verbatim as its fixture.
Live QA
Detection was verified end to end against the running app, not just unit tests. A throwaway bundle signed as
com.stablyai.orca.local(a watched identity) triggered a real macOS consent dialog while the app was running. After the copy revision, the notice was re-rendered in the Electron app from this branch and the screenshots were refreshed:The notice with user-facing copy:
In context:
The corrected settings row:
What the run proved, in order:
promptCountwent 0 → 1 on the first live prompt.{"promptCount":3}over the real IPC channel.dismissed: true) and stops the watcher — process count dropped to 0.All QA state was reverted:
tccutil reset All com.stablyai.orca.local, throwaway bundle deleted, isolated profile removed.Cross-platform / scope
before-quit—log streamignores a closed stdout and would otherwise outlive the app.logbinary must never affect startup.developerPermissionsIPC for the settings row.Verification
Two CI-only failures were found and fixed rather than papered over:
start()is darwin-gated, so on CI it no-opped and the stream/kill assertions never exercised anything. The platform is now pinned per the existing repo convention, with an explicit non-darwin case covering the gate itself.attachMainWindowServicesis called directly by its own unit test, so wiring the watcher there madevitest src/main/window/spawn reallog streamchildren that outlived the run — a single test session left two orphaned watchers. The spawn moved to the app bootstrap, which tests never execute; re-running that suite now leaves the watcher count unchanged.Honest caveats
kTCCServiceSystemPolicyAppDataspecifically. Both the captured dialog and the live QA usedSystemPolicyDocumentsFolder; on this machine AppData is never consulted (container access is a silent FDA-level deny). The event shape is service-independent and the service is a plain string match, but confirming the exact AppData path needs an affected machine.Closes #9756
Made with Orca 🐋
Final Electron validation (post-review)
Threshold notice rendered from an isolated profile seeded at
promptCount: 3:“Open Settings” routed to Settings → macOS Permissions → Full Disk Access: