Skip to content

feat(macos): show terminal-host Full Disk Access, tag stable-copy daemons, and give Helpers folder strings - #27354

Merged
Jinwoo-H merged 53 commits into
mainfrom
jinwoo/macos-terminal-host-extras
Oct 11, 2026
Merged

Jinwoo-H merged 53 commits into
mainfrom
jinwoo/macos-terminal-host-extras

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​274 $\color{#cf222e}{\Huge{\mathbf{−}}}$​16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​258
Prod 16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​200 $\color{#cf222e}{\Huge{\mathbf{−}}}$​40 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​160

ELI5

Stacked on #27021, which keeps terminals' macOS permissions working across app updates. This PR adds three things around that fix that it does not need to work:

  1. Settings tells you whether the terminal service itself has Full Disk Access, not only the app, and how to recover a terminal that lost it.
  2. Usage data can tell when a terminal service was started from the new private copy.
  3. The fallback path (when the private copy can't be used) gets the same Desktop, Documents and Downloads permission wording as the app.

What Changed

Full Disk Access per terminal host in Settings

  • Before: the Settings permission screen shows one Full Disk Access status, which is the app's. A terminal service that macOS has denied still shows "Granted".
  • After: the row reads "App: …" and, on macOS, adds "Terminal hosts: …". If any terminal service is not granted, it says how to recover: close the affected terminal in Terminal → Manage Sessions, or restart the daemon if new terminals are affected too.
  • Mechanism: a new fullDiskAccessStatus daemon request runs the existing Full Disk Access probe inside each running terminal service (current and older-protocol daemons). Any denied reply wins, and "granted" needs every one to be granted; anything else shows "unknown". If the daemon has degraded to local terminals, the app's own probe counts too. A daemon that predates the request, or one Orca can't reach, answers "unknown", never "granted". The probe now reads one byte instead of only opening the file, because opening alone can succeed while reading is denied.

stable-copy in daemon adoption telemetry

  • The existing spawner_path_class field gains stable-copy for a daemon whose spawner lives under userData/daemon-host/macos/terminal-host-*. Before this, such a daemon would be reported as other.

Folder descriptions in the app's Helper bundles

  • When the private copy can't be used, terminals still run in the app's Orca Helper process. After packaging, the build now writes the Desktop, Documents and Downloads descriptions into every <App> Helper*.app Info.plist, so the fallback asks for folder access with the same wording as the app.

Why

These were part of #27021 and moved here so that PR stays limited to the fix itself. Each one is independent of how the daemon starts:

Mixed versions: an #27021 (protocol v45) daemon that lacks the new request answers it with an error, which Orca shows as "unknown". No protocol bump and no new stream opcode.

Linked Issue

Part of #13921, which #27021 fixes.

Visual Proof

Settings permission screen, rendered in a hidden test window with injected replies: app granted, terminal host denied.

Before:

Permission screen before

After:

Permission screen after

Testing

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

Run locally on macOS (arm64):

  • pnpm tc passes.
  • Daemon, packaging, permissions, telemetry and Settings tests: 2642 passed, 15 skipped, 2 failed. The 2 failures are repro-13767-shell-ready-marker-lost-to-exec.test.ts, which also fails on main on this Mac.
  • pnpm run check:reliability-gates passes; the gate's focused command runs 84 tests, all passing.
  • oxlint is clean on the changed files.

Tests cover: the daemon answering the new request; the adapter mapping old daemons and lost contact to "unknown"; denied/unknown precedence across current and older daemons; the Settings row and recovery text; the stable-copy classification; and writing the descriptions into Helper bundles while leaving other helpers alone.

Review

Split from #27021, where this code was reviewed together with the launcher. The content matches #27021's head before the split (7be6448a885), plus a refreshed reliability-gate evidence entry.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

macOS only. On Linux and Windows the Settings row is unchanged and no terminal-host status is requested. SSH and remote hosts are not queried; only local daemons are. Merge after #27021.

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)

nwparker and others added 30 commits October 7, 2026 15:36
…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.
…on on the pinned Node

Contents/Helpers/Orca Terminal Host.app carries the pinned Node, the daemon's
out/main JS and this slice's node-pty, signed inside-out as com.stablyai.orca.
afterPack boots it through one PTY round trip, then fails the build on layout,
Info.plist, macOS floor (NODE_RUNTIME_DARWIN_MINIMUM_OS vs Node's minos),
architecture or signature drift.
Packaging now fetches the darwin Node from nodejs.org, whose download has no
retry. Each mac workflow caches it with the electron-builder downloads, keyed on
the pin, and warms both darwin targets inside the existing retry wrapper.
…r, not the whole app

The stable launch now clones Contents/Helpers/Orca Terminal Host.app (~124 MiB
instead of ~628 MiB) and runs its Node on its daemon entry, without
ELECTRON_RUN_AS_NODE. The copy must still match the running app's designated
requirement. A missing helper falls back to the fork, and macOS below the
helper's Node floor forks without copying.
…ways clean up

A daemon that stayed silent hung packaging past the 20 s deadline; one that closed the
connection left the hello unsettled so Node exited 0 without cleanup; a malformed line threw
uncaught. Every connect, hello and PTY wait now races the deadline, close/error/parse failures
reject, and the daemon and scratch dir are removed on every path.
…fallback

Sharing the electron-builder cache let old Node archives accumulate through restore-keys.
Also moves release-mac-build's Electron cache comment back onto its step.
…s name in one test

packageMacTerminalHost turned an unknown arch into darwin-undefined; it now throws through the
shared mac arch mapping. A test asserts the packager and the desktop agree on the helper bundle
and executable names, replacing a Linux/Windows test that could not fail.
…minal-host

# Conflicts:
#	src/main/codex/codex-background-terminals.ts
#	src/main/daemon/daemon-out-of-process-launcher.ts
The previous commit took the file from a newer main, which pulled unrelated strings into this PR.
…r a fixed launchd label

Name the copy after the helper's CDHash, reuse it when present, and
publish a new one by cloning into a staging dir, verifying it once
against the app's designated requirement and renaming it into place.
One launchd label per profile and protocol replaces per-launch labels,
so job.json, producer pids and per-label collection go away. Retirement
deletes any other copy lsof shows unused. The stable launcher returns
null for every fork fallback and logs its reason.
…ves them

A nested package's own dependencies were never walked, so a hoisted
dependency of a nested package was left out of the helper. Resolve each
dependency through the node_modules lookup Node performs from its parent
and copy it to the same relative place, unless a copied package already
carries it.
…minal-host slice

An arm64 runner without Rosetta skipped the x64 helper's PTY boot check
and shipped the slice untested. Release channels and CI now fail there;
local cross-arch builds still skip with a log line.
… into jinwoo/macos-terminal-host-extras

# Conflicts:
#	config/reliability-gates.jsonc
#	docs/reference/macos-daemon-tcc-attribution.md
#	src/main/daemon/macos-daemon-bundle.ts
…minal-host

# Conflicts:
#	src/main/daemon/daemon-launched-child-spawn.ts
#	src/main/daemon/daemon-out-of-process-launcher.ts
@Jinwoo-H
Jinwoo-H changed the base branch from jinwoo/macos-slim-terminal-host to main October 11, 2026 18:54
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

Walkthrough

The change adds terminal-host Full Disk Access status reporting to the daemon, IPC, and settings pane. It updates the macOS permission probe to read one byte from the TCC database. Daemon adoption telemetry now classifies paths under a recorded private stable-copy prefix. The macOS packaging hook adds folder-usage descriptions to matching Electron Helper plists.


Priority: ➖ Normal

Merge Risk: 🔵 Low · up to 80f6d

An empty probe file could produce a misleading access status, and the recovery wording could prompt an unnecessary daemon restart. These are bounded concerns; the differing test counts remain unexplained.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 22 files. (3 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly summarizes the three main macOS changes: terminal-host Full Disk Access reporting, stable-copy daemon telemetry, and Helper folder descriptions.
Description check Passed The description is complete and aligned with the template. It explains the user impact, implementation, rationale, linked issue, visual proof, testing, platform scope, and checklist status. It also re…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Full details: Docstring Coverage

Explanation

Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 22 files. (3 skipped: 3 unsupported.)


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

… into jinwoo/macos-terminal-host-extras

# Conflicts:
#	src/main/daemon/daemon-pty-adapter.ts
#	src/main/daemon/types.ts
…-host-extras

# Conflicts:
#	config/electron-builder.config.cjs
#	config/reliability-gates.jsonc
#	config/scripts/macos-folder-usage-descriptions.cjs
#	config/scripts/macos-folder-usage-descriptions.test.mjs
#	docs/reference/macos-daemon-tcc-attribution.md
types.ts hit the line limit once the Full Disk Access status request joined the union.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bcf826c1-5b95-44a7-a51a-da1a7fbffb01
📥 Commits

Reviewing files that changed from the base of the PR and between 1c4f16e and 80f6d79.

📒 Files selected for processing (25)
  • config/electron-builder.config.cjs
  • config/reliability-gates.jsonc
  • config/scripts/macos-folder-usage-descriptions.cjs
  • config/scripts/macos-folder-usage-descriptions.test.mjs
  • docs/reference/macos-daemon-tcc-attribution.md
  • src/main/daemon/daemon-adoption-telemetry-event.test.ts
  • src/main/daemon/daemon-adoption-telemetry-event.ts
  • src/main/daemon/daemon-full-disk-access-status.test.ts
  • src/main/daemon/daemon-full-disk-access-status.ts
  • src/main/daemon/daemon-health-requests.ts
  • src/main/daemon/daemon-pty-adapter-full-disk-access.test.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • src/main/daemon/daemon-request-router.ts
  • src/main/daemon/daemon-server.test.ts
  • src/main/daemon/types.ts
  • src/main/ipc/developer-permissions.test.ts
  • src/main/ipc/developer-permissions.ts
  • src/main/macos-full-disk-access-status.test.ts
  • src/main/macos-full-disk-access-status.ts
  • src/renderer/src/components/settings/DeveloperPermissionsPane.test.tsx
  • src/renderer/src/components/settings/DeveloperPermissionsPane.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/shared/daemon-adoption-telemetry.test.ts
  • src/shared/daemon-adoption-telemetry.ts
  • src/shared/developer-permissions-types.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Comment on lines +20780 to +20781
"durationSeconds": 2.38,
"summary": "All 82 focused launch, fallback-deadline, per-build copy, retirement, status and packaging tests passed."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

printf '%s\n' '--- current receipt ---'
nl -ba config/reliability-gates.jsonc | sed -n '20768,20784p'
printf '%s\n' '--- PR diff for receipt ---'
git diff --unified=12 1c4f16e21245001578388fbe3d26ae304554938e 80f6d7922082e4d583d9e946b529aee1187b5ff6 -- config/reliability-gates.jsonc | tail -n 100
printf '%s\n' '--- focused-count references in the changed file ---'
rg -n -F -- '82 focused' config/reliability-gates.jsonc || test "$?" -eq 1
rg -n -F -- '84' config/reliability-gates.jsonc || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 29218


🏁 Script executed:

nl -ba config/reliability-gates.jsonc | sed -n '20768,20784p'
git diff --unified=12 1c4f16e21245001578388fbe3d26ae304554938e 80f6d7922082e4d583d9e946b529aee1187b5ff6 -- config/reliability-gates.jsonc | tail -n 100

Repository: stablyai/orca

Length of output: 7718


Reconcile the focused-test count.

The recorded command reports 82 tests, while the PR reports 84. Check the actual command output. Update the receipt only if the command produced 84; otherwise correct the PR report to 82.

Running old daemons keep their terminals; a denied terminal is recovered by closing it or restarting
the daemon.
Running old daemons keep their terminals; settings reports app and terminal-host Full Disk Access
separately, and a denied terminal is recovered by closing it or restarting the daemon. The packaging

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reserve daemon restarts for terminals that remain affected.

Line 126 presents restarting the daemon as equivalent to closing one denied terminal. The PR guidance recommends a restart only when new terminals are also affected, and notes that restarting closes the daemon’s current terminals. Clarify that users should save work and close the affected session first.

The PR objective specifies this recovery sequence.

const handle = await open(filePath, 'r')
await handle.close()
try {
await handle.read(Buffer.alloc(1), 0, 1, 0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not report granted when the read returns no bytes.

If TCC.db exists but is empty, handle.read() can succeed with bytesRead: 0. The probe then reports granted without reading protected content. Check bytesRead and return unknown for a zero-byte read. Keep the handle closure in finally. Node.js documents zero bytes as EOF. (r2.nodejs.org)

Proposed change
--- "a/src/main/macos-full-disk-access-status.ts"
+++ "b/src/main/macos-full-disk-access-status.ts"
@@ -8,7 +8,10 @@
 async function readProbeByte(filePath: string): Promise<void> {
   const handle = await open(filePath, 'r')
   try {
-    await handle.read(Buffer.alloc(1), 0, 1, 0)
+    const { bytesRead } = await handle.read(Buffer.alloc(1), 0, 1, 0)
+    if (bytesRead !== 1) {
+      throw new Error('Full Disk Access probe read no data')
+    }
   } finally {
     await handle.close()
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await handle.read(Buffer.alloc(1), 0, 1, 0)
const { bytesRead } = await handle.read(Buffer.alloc(1), 0, 1, 0)
if (bytesRead !== 1) {
throw new Error('Full Disk Access probe read no data')
}

@Jinwoo-H
Jinwoo-H merged commit e22fd9c into main Oct 11, 2026
44 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.

2 participants