Repository navigation
Conversation
|
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:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe changes add a launchd-based stable-bundle startup path for packaged macOS terminal daemons. They verify bundle identity, check launch-job state, limit fork fallback by a deadline, and guard runtime-copy cleanup. They also add terminal-host Full Disk Access reporting to the daemon RPC and settings interface. The macOS package applies folder-usage descriptions to the app and matching helper apps. Tests, telemetry, documentation, and a reliability-gate entry cover these changes. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🟡 Moderate · up to The terminal-daemon launch fallback concern should be resolved or explicitly accepted before merging. The manual test harness may also hang. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation [ Full details: Docstring CoverageExplanation Docstring coverage is 20.41% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 49 functions across 45 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
11df61a3-1ed6-47fb-85c0-f4084012520b
📒 Files selected for processing (50)
config/electron-builder.config.cjsconfig/reliability-gates.jsoncconfig/scripts/macos-folder-usage-descriptions.cjsconfig/scripts/macos-folder-usage-descriptions.test.mjsdocs/reference/macos-daemon-tcc-attribution.mdsrc/main/daemon/daemon-adoption-telemetry-event.test.tssrc/main/daemon/daemon-adoption-telemetry-event.tssrc/main/daemon/daemon-full-disk-access-status.test.tssrc/main/daemon/daemon-full-disk-access-status.tssrc/main/daemon/daemon-init-macos-stable-launch-fallback.test.tssrc/main/daemon/daemon-launched-child-spawn.tssrc/main/daemon/daemon-mac-code-identity.test.tssrc/main/daemon/daemon-mac-code-identity.tssrc/main/daemon/daemon-out-of-process-launcher.tssrc/main/daemon/daemon-permission-requests.tssrc/main/daemon/daemon-pty-adapter-full-disk-access.test.tssrc/main/daemon/daemon-pty-adapter.tssrc/main/daemon/daemon-request-router.tssrc/main/daemon/daemon-server.test.tssrc/main/daemon/macos-daemon-bundle-retirement.test.tssrc/main/daemon/macos-daemon-bundle-retirement.tssrc/main/daemon/macos-daemon-bundle.test.tssrc/main/daemon/macos-daemon-bundle.tssrc/main/daemon/macos-daemon-job-state.test.tssrc/main/daemon/macos-daemon-job-state.tssrc/main/daemon/macos-daemon-launchd.test.tssrc/main/daemon/macos-daemon-launchd.tssrc/main/daemon/macos-daemon-startup-budget.tssrc/main/daemon/types.tssrc/main/ipc/developer-permissions.test.tssrc/main/ipc/developer-permissions.tssrc/main/macos-full-disk-access-status.test.tssrc/main/macos-full-disk-access-status.tssrc/renderer/src/components/settings/DeveloperPermissionsPane.test.tsxsrc/renderer/src/components/settings/DeveloperPermissionsPane.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/shared/daemon-adoption-telemetry.test.tssrc/shared/daemon-adoption-telemetry.tssrc/shared/developer-permissions-types.tssrc/shared/telemetry-daemon-event-schemas.tstests/tools/macos-tcc-update/.gitignoretests/tools/macos-tcc-update/daemon.cjstests/tools/macos-tcc-update/parent.cjstests/tools/macos-tcc-update/product-launch.tstests/tools/macos-tcc-update/product.pytests/tools/macos-tcc-update/run.pytests/tools/macos-tcc-update/ui/fixture.csstests/tools/macos-tcc-update/ui/fixture.tsxtests/tools/macos-tcc-update/ui/index.htmltests/tools/macos-tcc-update/ui/prepare.mjs
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f27f03b6-9213-4b30-b616-ca47a8af3cbf
📒 Files selected for processing (4)
src/main/daemon/daemon-launched-child-spawn.tssrc/main/daemon/daemon-out-of-process-launcher.tssrc/main/daemon/macos-daemon-launchd.test.tssrc/main/daemon/macos-daemon-launchd.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
66cf4ae to
83665e9
Compare
…ndpoint A copy, signature, plist or deadline failure before bootstrap, a bootstrap launchd refused with the job absent, a job whose daemon exited before answering, and a foreign endpoint all threw out of the launcher. The app then lost its persistent daemon and fell back to local PTYs, where main forks one. These now fall through to the existing fork path, which also adopts a foreign occupant normally instead of as a degraded endpoint. A timed-out bootstrap or a job still running/unreadable stays fatal, so no second daemon races it.
daemon_adopted, daemon_pty_cwd_denied and daemon_pty_cwd_readable gain a closed-enum launch_method (stable-copy / app-fork / unknown), read from the spawner path the daemon recorded, so the update fix is measurable per daemon even when an old forked daemon is adopted across updates. The reliability gate is a test manifest with no runtime switch, so there is no gate state to report; spawner_path_class reports the private copy as 'other' alongside other non-/Applications installs.
The separate launch_method property duplicated what the recorded spawner path already says. spawner_path_class gains `stable-copy`, classified from the same path under the private runtime root, and launch_method, its enum and classifier are removed from all three .strict() daemon origin events. A deleted copy still reports `missing`.
The permissions handler already asks for the terminal-host status only on macOS, so the status function's own platform check and the pane's 'unsupported' branch could never fire. The off-macOS guarantee is now tested at the handler.
The stable launch could run until 55 s after the launch started, so a late "unavailable" verdict left the fork fallback's own 10 s readiness wait to finish after the 60 s gate had already moved the app to local PTYs. The launcher now gives the stable attempt one handoff deadline: the gate minus the fork's readiness timeout and the 5 s lease/adapter allowance (45 s). Copy, signature check and plist conversion share one abort signal that ends early enough for bootstrap and the job's own readiness wait to meet that deadline; every command otherwise keeps a fixed timeout. An unavailable verdict past the deadline is reported instead of forking a daemon that cannot arrive in time. The per-step budget module is gone (its deletion landed in the previous commit by a staging slip). The launch body is now two blocks: preparation (plist, plutil, deadline check) fails as unavailable after removing the copy and job file, and bootstrap runs in its own try/finally that always deletes the job file. Retirement is simpler and claims more orphans: one in-flight collection per process instead of a per-root map and rotating 20-record scan, and the job record (written before copying) no longer carries a bundle name because lsof +D scans the whole runtime directory (measured equal cost, same result on a live copy). A never-submitted copy is retired once its producer has exited and its job is missing, so a bootstrap timeout or a crash mid-copy no longer leaves a copy forever; the open-file check still guards deletion. Collection now starts from the launcher after the attempt.
The signed investigation harness left the tree in the previous telemetry commit by a staging slip; its results and pinned link stay in the PR. This trims the reference doc to why the copy and launchd exist, the fallback states and the cleanup rule, trims the reliability gate to what its validator needs, and points AGENTS.md at the reference doc next to the Windows relocation entry.
A copied daemon refused at exec (for example by Gatekeeper) never answers, so every fresh start paid the full 10 s readiness wait before the fork fallback. The readiness loop now reads the job state every 500 ms and abandons as soon as the job is stopped or missing; a running or unreadable job is still waited out and never forked beside. Also drops the dead forkEntryPath the stable launch never read (its options type now omits it) and un-exports the handoff constant.
…d ones Each runtime copy is a full Orca.app, so Spotlight indexed it as an app and LaunchServices kept a record for it that outlived the copy. A registered copy claims orca: links and Markdown/CSV files, and becomes their default handler whenever /Applications/Orca.app is not registered. New copies go under runtime-*/app.noindex/, which Spotlight skips and which stops the record LaunchServices made while the bundle was being copied. Retirement now runs lsregister -u on every bundle in the copy (both the app.noindex layout and the earlier runtime-*/Orca.app layout) once lsof shows it unused, then deletes it. A running copy stays registered, because Local Network access may be resolved through that record. Collection and stable-copy telemetry match the runtime-* directory, so copies made before this change are still adopted, classified and retired.
The reference doc now explains why copies sit in a .noindex folder, why only retired copies are unregistered, and how to turn the copy launch off: make launchMacDaemonFromStableBundle return null, and keep the retirement code until no copy-launched daemon can remain, because the old code never deletes copies. A test pins that rollback: with the stable launcher returning null, the launcher forks and still runs the copy collection.
…e them The `.noindex` folder kept copies out of Spotlight and LaunchServices, but Local Network access is resolved from the signing identifier through LaunchServices to the executable's Mach-O UUID. After an update that changes Electron only the copy carries the running daemon's UUID, so an unregistered copy risks the same Local Network loss main has today. Copies go back to `runtime-*/Orca.app`; retirement still unregisters each copy before deleting it, so deleted copies leave no LaunchServices entry. The remaining trade-off: while `/Applications/Orca.app` is missing, a running registered copy can be picked for `orca:` links and documents.
Spotlight listed each runtime copy as a second Orca app. New copies go back under runtime-*/app.noindex/Orca.app, which Spotlight skips. Retirement and stable-copy telemetry match the runtime-* directory, so copies in the earlier runtime-*/Orca.app layout still retire and classify the same way. Local Network access identifies the daemon by its code signature and main-executable UUID, not by a LaunchServices record, so an unregistered copy keeps it. The launchd job now sets AssociatedBundleIdentifiers to com.stablyai.orca, which is how a job not installed through SMAppService names the app it belongs to. Copies are never registered explicitly; retirement still runs lsregister -u before deleting each one.
01a12fd to
aa607ef
Compare
|
Closing in favour of #27021, which carries this fix forward. Instead of a copy of the whole app, it runs the daemon from a small signed helper (about 124 MB instead of 628 MB) that keeps Orca's identity, and it reuses one copy per build. The settings status and telemetry from this PR continue in #27354. |
ELI5
After a macOS update, terminals can lose access to protected files even while Orca's permission checkbox stays enabled. Keep the terminal service in its own signed app copy so replacing the visible app cannot break its privacy identity.
What Changed
Packaged macOS GUI launches now copy and verify the running signed bundle, then start its main executable independently through launchd in Node mode. The existing authenticated handshake and launch nonce establish ownership. App updates cannot move or delete this runtime. Settings report the app's Full Disk Access separately from every terminal host, including older generations and the in-process fallback; unavailable answers remain unknown. The probe reads one discarded byte and closes the handle even on read denial, rather than treating an allowed open as content access. Desktop/Documents/Downloads descriptions are added to the app and all Electron Helpers before signing, because the fork fallback still runs the daemon as
Orca Helper.Live sessions are preserved. Idle upgrades and deliberate restart use the existing recovery flows. Cleanup unregisters only an owned job and removes its copy only after an open-file check (
lsof +Dover the copy) establishes no use; uncertain inspection retains code. Copies live underruntime-*/app.noindex/, which Spotlight skips, so a copy is never listed as a second Orca app. Orca never registers a copy with LaunchServices (the macOS database that picks which app opensorca:links and Markdown/CSV files), and retirement removes any record macOS made on its own (lsregister -u) before deleting the copy. Local Network access does not depend on that record: macOS identifies the daemon by its code signature and main-executable UUID, and the launchd job names Orca throughAssociatedBundleIdentifiers, the key a job not installed through SMAppService uses to say which app it belongs to. Copies in the earlierruntime-*/Orca.applayout still retire and classify the same way. A copy that was never submitted is also retired once its producer has exited and its job is missing, so a bootstrap timeout or a crash mid-copy no longer leaves it behind. The stable attempt must hand off by 45 s after the launch starts, so the fork fallback's own 10 s readiness wait and 5 s adapter install still fit the 60 s startup gate; copy, signature check and plist conversion share one abort signal that stops early enough for bootstrap and the job's readiness wait to fit as well. If the copied daemon's job exits before answering (for example refused at exec), the readiness wait notices within about 500 ms and hands off to the fork instead of waiting the full 10 s. Background retirement runs once per launch, one collection at a time, never per terminal. If the copy, signature check, plist or bootstrap fails in a way that proves no launchd job can still claim the terminal socket, Orca falls back to today's forked daemon, so terminals stay persistent for that run (only without the update protection). A bootstrap that timed out, or a job still running, stays an error so two daemons never race. Thedaemon_adopted,daemon_pty_cwd_deniedanddaemon_pty_cwd_readableevents report a daemon started from the private copy asspawner_path_class=stable-copy, which identifies the fix per daemon.Why
A signed native experiment reproduces lasting EPERM when a cold detached Helper first reads during the updater's app-path gap. Restoring the path leaves that Helper denied; a fresh Helper succeeds. Deleting an already warmed Helper image alone does not reproduce denial, so an unresolvable executable is insufficient evidence for killing sessions. An independent signed launchd app copy succeeds during the same gap. The independent signed app covers both path lifetime and responsibility while using the existing Orca grant. Restarting every daemon on update would discard live work, and copying only the executable would omit the signed resources and native dependencies. Related investigation: #20452. The signed investigation harness and its repeat commands are no longer in the diff; they are preserved at the investigation and repeat commands (pinned commit).
Rollback
To turn this off, make
launchMacDaemonFromStableBundleinsrc/main/daemon/macos-daemon-launchd.tsreturnnullat its first line; every launch then takes the fork path (a test pins that the launcher still forks and still runs the copy collection). Keep the retirement code (macos-daemon-bundle-retirement.tsand theretireAbandonedMacDaemonBundlescall in the launcher'sfinally) until no copy-launched daemon can remain. Never revert the cleanup: the old code never deletes copies, and each keeps about 567 MB after an update removes the bundle it was cloned from.Linked Issue
Fixes #13921
Visual Proof
Same injected app-granted / terminal-host-denied replies, rendered through Playwright CDP in hidden Electron. Before reports only “Granted”; after distinguishes the hosts and explains recovery. Native protected-file evidence is separate below.
Before:
After:
Testing
Signed native macOS 26.3.1 arm64 experiment reproduces the original lasting denial and proves the independent identity survives. The rebuilt production launcher passed 22 real PTY checks for cwd, file contents, Apple Git and FDA across Desktop/Documents/Downloads, two different signed bundle replacements, old-bundle deletion, six fresh terminals and reconnect with the same daemon. The actual Helper packaging hook preserves main and all Helper designated requirements. The packaging-hook cold launch was 6.8 seconds and the reviewed run was 8.0 seconds and the final content-read probe run was 8.7 seconds; an earlier concurrent-test run was 25.9 seconds, neither a latency guarantee. Native abandoned-runtime collection removed an unused stopped copy after process exit, with no socket/token cleanup.
Native experiment results (macOS 26.3.1, matching designated requirements): Helper descendants before an update, allowed; a warmed Helper after its old executable is deleted, allowed; a cold Helper's first read while the app path is absent, EPERM, and still EPERM after the signed bundle is restored; a fresh Helper from the restored bundle, allowed; a launchd daemon from an independent signed copy, allowed during the gap and after restore.
After the simplification (re-run at
2893d219ee2), the real production launcher was run from an APFS clone of the installed app in Node mode: it copied and verified the bundle, bootstrapped the launchd job and completed the nonce-fenced handshake in 3.6 s; the daemon's image and recorded spawner were the copy (spawner_path_class=stable-copy); a PTY it hosted read one FDA-protected byte; a too-late deadline was refused with no job created; retirement removed a crashed copy while keeping the live copy and a live producer's copy; shutdown unregistered the job and removed the copy.lsof +Dcost the same on the copy and its runtime directory (about 280 ms, same daemon listed). All jobs were booted out. Focused status/packaging/recovery tests, localization catalog and extraction checks,pnpm tc,pnpm run check:code-quality:changed, reliability-manifest validation andpnpm run build:electron-vitepassed. Denied/unknown/granted UI states were checked; denied was inspected in both themes. Gateterminal.macos-tcc-update-identityis experimental. That gate is a test-evidence entry, not a runtime switch: the new launcher is on for every packaged macOS GUI launch.Commit
0b5f6c48e09bpassed all five full unit-test shards, relay integration, full lint/localization/type checks, mobile verification, Linux and Windows packaging, and native smoke on Linux, Windows and macOS. CI run. At2893d219ee2(after merging main once),pnpm lint,pnpm tc, the changed-code gate, reliability-manifest validation and the focused suites pass locally. In the daemon suite (2,440 tests), the only failures on this Mac are the 2 real-PTY #13767 repro tests, which fail identically on the merge-base main checkout.LaunchServices (macOS 27.0, read-only
NSWorkspacequeries, owned clones and labels only): aruntime-*/Orca.appcopy gets a record while it is being copied and a fullcom.stablyai.orcarecord when executed directly (the user's live copy was fully registered within 38 s); with a test identifier, a registered copy became the default handler for its URL scheme and document type once the installed bundle was unregistered, andlsregister -uremoved it. The real launcher from a copy passedcodesign --verify --deep --strictand the requirement match, a PTY it hosted read one FDA-protected byte and reached the local gateway, and a registeredruntime-*/Orca.appcopy classified asstable-copyand retired with its record removed. With theapp.noindexlayout (re-run at the head of this PR): Spotlight never listed the copy, while a sibling clone outside.noindexappeared within about 130 s; cloning left no LaunchServices record; the real launcher's daemon, with a PTY that read one FDA-protected byte and connected to the local gateway on port 53, left no record through 65 s, and retirement removed the copy. Running the copy's executable in Node mode from another process (a shell, or a child of a test daemon) gave it a full record in 5 of 7 attempts; Orca's daemon does not start its executable that way, and retirement removes such a record.Physical x64/older macOS, real GUI ShipIt quit/relaunch, logout/login, notarized release Gatekeeper, non-APFS performance and individual folder grants without FDA need release-lane coverage. Local Network was checked from registered copies and from unregistered
app.noindexcopies whose job setsAssociatedBundleIdentifiers, all with the same executable as/Applications/Orca.app; a copy left behind by an Electron-changing update, whose executable differs from the installed app's, was not tested, to avoid a consent prompt. Accessibility and Automation are outside the measured FDA reproduction. Linux/Windows and Node/SSH hosts bypass the new launcher in guard tests; their existing paths and remote/mobile wire are unchanged.Review
Ownership, startup deadlines, signed-copy integrity, checked responses and unknown-preserving cleanup reviewed. Existing legacy sessions are not automatically killed; already denied old terminals require deliberate recovery. An unverifiable job state or open-file check can retain an orphan copy rather than risk deleting live code.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
No protocol bump or stream opcode. The additive daemon request falls back to unknown with older hosts. The launcher is independent of workspace type and only operates on the local packaged macOS GUI host.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Used the changed-code quality gate and Electron/Vite build locally; CI passed full lint/type checks, the full unit suite and Linux/Windows packaging. Notarized macOS release coverage remains in the release gaps above. The diff includes ownership, deadline and cleanup tests, so it is larger than a small patch.