Skip to content

fix(macos): tell the user when Orca's terminal service can't read their folder, and walk them through the fix - #21923

Merged
Jinwoo-H merged 40 commits into
mainfrom
sta-7948-folder-access-notice
Sep 22, 2026
Merged

Jinwoo-H merged 40 commits into
mainfrom
sta-7948-folder-access-notice

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2614 $\color{#cf222e}{\Huge{\mathbf{−}}}$​102 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2512
Prod 32 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1419 $\color{#cf222e}{\Huge{\mathbf{−}}}$​126 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1293

ELI5

On macOS, Orca's terminal service can lose access to Documents, Desktop, or Downloads while Orca itself still reads them. Terminals opened there fail with "Operation not permitted" and agents die. About 1,400 users hit it over three weeks and nothing told them. This PR notices it, tells the user once, and walks them through the fix in one dialog, with each step decided by evidence rather than guesswork.

What Changed

Before: terminals in a protected folder fail silently. The only remedy is a daemon restart buried in Manage Sessions, and nobody knows whether it will help.

After:

  1. Detection. The daemon's readability check now lists the folder (opendir + one read) instead of access(), which macOS lets through on protected folders even when listing fails. Main records a mismatch only when the daemon says denied and the app itself can read the same folder. Both reads are async and the app's is never awaited on the spawn path: on macOS the read is what raises the folder prompt, and a sync one would freeze the app for as long as the sheet is up.
  2. Toast, once per daemon and folder: "Terminals can't read your Documents folder", one sentence on what it costs, a Fix button. The X dismisses and latches it for that daemon and folder. No cancel button, matching every other toast in the app. Fix keeps the toast up behind the dialog (sonner deletes a toast after an action click unless the handler prevents it), so cancelling the dialog leaves the notice where it was; only a restart or the X takes it down.
  3. Fresh-daemon probe. Before asking for a restart, main forks a throwaway child the same way it forks the daemon (process.execPath, ELECTRON_RUN_AS_NODE) and has it list the folder. That child carries the attribution a restarted daemon would get, so its verdict answers "will a restart help" per user. Bounded at 3 s, argv only, scrubbed env, single JSON line; anything else reads as unknown.
  4. Fix dialog, a two-step checklist with the active step's one action in the footer:
    • Fresh daemon can read: step 1 already green, footer is Restart.
    • Fresh daemon still denied: step 1 becomes "Re-allow Orca for your Documents folder" and the footer is Reset permission. Main runs tccutil reset for that folder class and Orca's bundle id, reads the folder itself (async, so the blocking macOS sheet cannot stall the event loop) so macOS prompts from the app, then forces a re-probe. Allowed turns step 1 green; still denied says so and surfaces Open System Settings as the fallback. Reset is offered only for Documents, Desktop, and Downloads, the folders macOS keeps a per-app permission row for; a denial anywhere else goes to Open System Settings. If the macOS sheet sits unanswered for 60 s the read is no longer awaited and the reset reports unknown to both the dialog and telemetry, so "still blocked" only ever shows on a measured denial.
    • Probe couldn't answer: says so, offers Settings and Restart.
    • Restart runs restartDaemon() directly. Success is shown by the checklist (both green, footer Done), not a sentence. Open terminals and agents come back through the existing cold-restore resume path.
  5. Manage Sessions restart confirmation copy now says what a restart does: "Open terminals and agents will restart. Terminals on remote hosts are not affected."
  6. Telemetry: daemon_folder_access_notice with action ∈ shown, fix_opened, dismissed, settings_opened, reset_clicked, restart_clicked, reset_outcome_{allowed,still_denied,unknown}, restart_outcome_{fixed,still_denied}, plus cwd_class. Outcomes are emitted from main, from the re-probe or the replacement daemon's first spawn, so they measure what happened rather than what was clicked. daemon_pty_cwd_denied stays as the denominator.

Mechanics worth knowing: evidence is keyed by daemon identity (pid, start time, launch nonce) plus folder class and held in one main-process entry, so one daemon denied a second folder is a new notice rather than a retitled one; a restart mints a new identity so the next poll returns null and the toast clears itself. The dialog is derived from that evidence: it renders the latest verdict for the scope the user opened, and any verdict for another scope or for no scope ends the open remedy, so no remedy state can outlive its evidence. A null verdict, whether from a poll or from the reset's re-probe, also retires the toast from inside the store, so no caller has to remember to. Sonner fires onDismiss for programmatic dismissals too, so the hook clears its scope before any programmatic takedown and only a user's X counts as dismissed. The tccutil reset and bundle-id read were extracted from the computer-use permissions code into one shared module rather than duplicated.

Why

PostHog (21 days): 1,438 users emitted daemon_pty_cwd_denied, 96% on Documents/Desktop/Downloads, 96% with a daemon from a different app version. Every one of them already had the folder enabled for Orca; that is the trigger condition. Of 255 later observed with a same-version daemon, 30 were denied again by that same-version daemon in the same folder class (another 45 were denied by yet another different-version daemon, i.e. the bug recurring after a further update, which a restart fixes). So "restart" is right for most and wrong for roughly one in eight, and no Settings action has ever been verified for that group. The design follows from that:

  • The probe exists so the dialog never spends every open terminal on a restart that a fresh daemon proves will fail.
  • The reset step exists because it is the in-app form of the only documented recovery (tccutil reset + re-allow) and the one lever we can measure. It ships gated behind the probe so the majority never see it, with its own outcome telemetry so a few weeks of data decide whether it stays. Nothing in the dialog claims a remedy that has not been observed to work.
  • Alternatives considered: a signed helper probing on behalf of old daemons (dropped: every daemon that produced the field data already ships the verdict); a separately signed daemon identity so the grant does not depend on which install forked it (deferred: extra prompts, does not cover the stuck third, mechanism still unproven); auto-restart on denial (rejected: kills terminals for the third it cannot help).

Linked Issue

Linear STA-7948. Related to #17696. Design: #21740.

Visual Proof

Before: nothing. Terminals in the folder fail with "Operation not permitted" and no UI mentions it.

After, toast:

pr-toast.png

Fix dialog when a fresh daemon is still denied (reset offered):

pr-dialog-denied.png

Fix dialog once a fresh daemon can read (restart offered):

pr-dialog-allowed.png

Testing

  • macOS only by construction; every new path is behind process.platform === 'darwin' or the macOS-only poll. Linux/Windows: the web fallback returns null/unsupported and nothing renders. SSH: remote hosts never reach this code (local daemon adapter only) and the restart copy says so.

  • Manual, dev build with an uncommitted debug switch forcing the mismatch: toast, Fix, both dialog branches, reset, restart, Done, toast clearing on the new daemon identity; Fix → Cancel → refocus keeps exactly one toast, X → refocus keeps it gone.

  • Manual, ad hoc packaged build under a test bundle id launched via open (so macOS holds it responsible for itself): Reset permission ran the real tccutil reset, macOS showed its Documents sheet, Allow wrote a fresh TCC row for the test bundle id, the re-probe passed, step 1 turned green, Restart completed.

  • Not verifiable here: that the reset fixes an actually broken grant. No machine in the team has the state and it cannot be reproduced on demand. The outcome telemetry is the test.

  • Automated: 193 tests across 9 files for the probe, evidence store (record/clear/identity/scope per folder class/force re-probe race), reset flow (class gate, prompt deadline), IPC shapes, toast hook (once per scope, dismiss latch, a replaced toast's dismissal ignored, re-show after a null poll), dialog states (derivation from the latest verdict, close on moved or cleared evidence, no self-reopen when a scope returns, Fix leaves the toast up, per-button busy labels, reset error cleared by a later grant), and telemetry enum. pnpm tc:node, pnpm tc:web, check:code-quality:changed, and the four verify:localization-* scripts pass.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

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 probe child runs argv only with a scrubbed env and a 3 s deadline; the reset runs tccutil with a fixed service name from a closed map and the app's own bundle id, never user input. Telemetry carries a folder class and an action, never a path. Performance: nothing new on the PTY spawn path beyond one opendir; the probe runs only from the focus-time poll, which awaits it (3 s deadline) and reuses a result younger than 5 s. Wire: the cwdReadableByDaemon field keeps its name and type; daemons that omit it produce no evidence.

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)

@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The change replaces cwd permission checks with directory enumeration and separates daemon divergence detection from event emission. It records folder-access mismatch evidence by daemon identity, probes fresh-daemon folder access, and exposes results through IPC and preload APIs. The renderer adds localized notices, a fix dialog, settings navigation, reset and restart handling, and action telemetry. It also registers and tests the expanded daemon_folder_access_notice schema.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 552a0

The folder-permission recovery flow can hide a real warning, show stale remediation status, or incorrectly report reset outcomes. Resolve these issues before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 75 functions across 37 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly and concisely describes the main macOS folder-access warning and guided fix introduced by the pull request.
Description check ✅ Passed The description is complete and directly addresses the template. It explains the user impact, implementation, rationale, linked issues, visual changes, testing, platform considerations, security, perf…
Full details: Docstring Coverage

Explanation

Docstring coverage is 38.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 75 functions across 37 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

@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: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 30bcf50e-ef14-4b77-aa96-b9bf342a4036

📥 Commits

Reviewing files that changed from the base of the PR and between 98299d8 and e7e595d.

📒 Files selected for processing (20)
  • src/main/daemon/daemon-adoption-telemetry-event.test.ts
  • src/main/daemon/daemon-adoption-telemetry-event.ts
  • src/main/daemon/daemon-folder-access-mismatch.test.ts
  • src/main/daemon/daemon-folder-access-mismatch.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • src/main/daemon/daemon-pty-session-spawn.ts
  • src/main/daemon/directory-enumeration-probe.ts
  • src/main/daemon/terminal-host-cwd-readability.test.ts
  • src/main/daemon/terminal-host-session-create.ts
  • src/main/ipc/pty-management.test.ts
  • src/main/ipc/pty-management.ts
  • src/preload/api-types.ts
  • src/preload/api/pty-management-api.ts
  • src/renderer/src/hooks/useMacTccAttributionSeveredNotice.test.tsx
  • src/renderer/src/hooks/useMacTccAttributionSeveredNotice.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/web/preload-api/web-terminal-api.ts
  • src/shared/daemon-adoption-telemetry.test.ts
  • src/shared/telemetry-daemon-event-schemas.ts
  • src/shared/telemetry-event-registry.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Comment thread src/main/ipc/pty-management.ts Resolved
Comment thread src/renderer/src/i18n/locales/en.json Resolved

@pullfrog pullfrog 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.

Important

The notice is only checked on hook mount and window focus. The app mounts that hook before workspace hydration and PTY creation is deferred to pane mount, so a spawn that records the mismatch happens while the window is already focused — no focus event follows, and the toast stays hidden until the user alt-tabs away and back.

Reviewed changes

  • Daemon cwd probe: isCwdReadableByThisProcess now uses enumerateDirectoryOnce (opendirSync + one readSync) instead of accessSync(R_OK|X_OK), so a TCC denial that lets access() pass is still caught while ENOENT/ENOTDIR/unexpected errors stay "readable".
  • Mismatch evidence store (daemon-folder-access-mismatch.ts): one entry keyed by daemon identity, exposing only {daemonScope, cwdClass}; clears only when the same daemon reads back a folder of the same class.
  • Spawn-path oracle: reportDaemonPtyCwdVerdict performs one app-side enumeration that feeds both daemon_pty_cwd_denied and the notice; pty-management carries the evidence on the existing macTccAttribution reply.
  • Renderer: a second toast in useMacTccAttributionSeveredNotice, latched per daemon scope per session.
  • Telemetry: daemon_folder_access_notice (shown from main; dismissed/open_manage_sessions from the renderer) with schema and registry entries.

⚠️ A spawn-recorded denial is not surfaced until the next window focus

Technical details
# Folder-access evidence has no poll trigger after it is recorded

## Affected sites
- `src/renderer/src/hooks/useMacTccAttributionSeveredNotice.ts:204-209` — the only `maybeToast()` calls are mount and the `window` `focus` listener; the effect deps contain nothing tied to spawn/daemon activity.
- `src/main/daemon/daemon-pty-session-spawn.ts:254-262` — evidence is recorded on a new spawn (`isNew && !attachOnly`), which occurs after hydration and pane mount, i.e. after the hook's mount poll.
- `src/main/ipc/pty-management.ts:74-76` — the comment itself calls this a focus-time poll.

## Required outcome
- Evidence recorded while the window stays focused must reach the toast without requiring a later focus/blur, otherwise the primary scenario (a new terminal opened into a denied folder) shows the user an unexplained "Operation not permitted" until they switch away and back.

## Suggested approach (optional)
- Notify the renderer / re-run the poll when `recordDaemonFolderAccessMismatch` stores new evidence, or re-poll on terminal-spawn failure, or add a bounded interval while a mismatch is pending.

## Open questions for the human (optional)
- Is the focus-only trigger deliberate, or is the spawn-after-mount ordering unaccounted for?

ℹ️ Nitpicks

  • StoredMismatch.canonicalPath and observedAtMs (src/main/daemon/daemon-folder-access-mismatch.ts:51-52) are written but never read, and canonicalPath isn't canonicalized. Either use them (e.g. observedAtMs for staleness) or drop them.
  • PtyManagementDaemonCwdClass (src/preload/api/pty-management-api.ts:21-26) re-declares DAEMON_PTY_CWD_CLASSES as a literal union, so adding a class to the shared enum would not fail the renderer's exhaustive folderAccessFolderName switch. The comment acknowledges the constraint; a compile-time tie (or a test comparing the two) would keep them from drifting.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread src/main/ipc/pty-management.ts Resolved

@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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: a884a166-1c7a-4544-b4af-d24803598a73

📥 Commits

Reviewing files that changed from the base of the PR and between e7e595d and adfe2ee.

📒 Files selected for processing (26)
  • src/main/daemon/daemon-folder-access-mismatch.test.ts
  • src/main/daemon/daemon-folder-access-mismatch.ts
  • src/main/daemon/daemon-folder-access-probe.test.ts
  • src/main/daemon/daemon-folder-access-probe.ts
  • src/main/ipc/developer-permissions.ts
  • src/main/ipc/pty-management.test.ts
  • src/main/ipc/pty-management.ts
  • src/preload/api/pty-management-api.ts
  • src/renderer/src/components/shared/MacFolderAccessFixDialog.test.tsx
  • src/renderer/src/components/shared/MacFolderAccessFixDialog.tsx
  • src/renderer/src/components/shared/mac-folder-access-folder-name.ts
  • src/renderer/src/components/shared/useDaemonActions.test.tsx
  • src/renderer/src/components/shared/useDaemonActions.tsx
  • src/renderer/src/hooks/MacosTccPromptNoticeHost.tsx
  • src/renderer/src/hooks/useMacTccAttributionSeveredNotice.test.tsx
  • src/renderer/src/hooks/useMacTccAttributionSeveredNotice.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/store/mac-folder-access-fix.ts
  • src/shared/daemon-adoption-telemetry.test.ts
  • src/shared/developer-permissions-types.ts
  • src/shared/telemetry-daemon-event-schemas.ts
💤 Files with no reviewable changes (5)
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/zh.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/i18n/locales/en.json

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@pullfrog pullfrog 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.

Important

The new fix dialog can reopen into a stale "Done." state after a denial recurs, hiding the Restart button for exactly the case where the restart was not enough. One inline comment.

Reviewed changes

  • Restart-viability probe: a scrubbed-env child (ELECTRON_RUN_AS_NODE=1, 3s deadline) now answers whether a freshly forked daemon could list the denied folder, surfaced as restartWillHelp and re-run from the existing focus poll behind a 5s interval; true is final.
  • Fix dialog: the folder toast now raises a two-step MacFolderAccessFixDialog (Allow Orca under Files and Folders → Restart), with Restart blocked when the probe says a restart alone would not help, plus a new shared store and mac-folder-access-folder-name helper.
  • Files-and-Folders permission: added files-and-folders as an open-the-pane-only DeveloperPermissionId, wired to the Privacy Files-and-Folders pane.
  • Restart-outcome telemetry: the first spawn by a different daemon into the same folder class emits restart_outcome_fixed / restart_outcome_still_denied; daemon_folder_access_notice gains fix_opened, settings_opened, and restart_clicked.
  • Manage Sessions copy: "Restart the terminal daemon?" and the old "Process exited / legacy sessions" description are rewritten to "Restart the terminal service?" / "Open terminals and agents will restart. Terminals on remote hosts are not affected."

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found in these commits. Not approving yet because the previously flagged dialog-state and focus-trigger items are unaffected by this delta.

Reviewed changes

  • Notice can return after a transient null poll: a folderAccessMismatch: null result now deletes the visible scope from folderScopesShown before dismissing, so a reconnect blip that briefly reads no daemon no longer latches the scope forever; a user dismiss still keeps it latched.
  • Toast reduced to one action: the folder toast drops the Not now button and records dismissed through Sonner's onDismiss, which is also fired by programmatic toast.dismiss() and guarded so a scope already cleared is not counted as a user dismissal.
  • Restart retirement moves into the store: on a successful restart the dialog now calls markRestarted(scope), and the notice hook retires the toast via restartedScope instead of the dialog dismissing it directly.
  • Dialog restructured to a checklist: steps no longer carry buttons; a new FixFooter holds the single active action (Open System Settings when a restart alone cannot help, Restart, or Close once done), and an unanswered probe now gets an explanatory step-1 helper.
  • Copy: the toast now states the cost ("commands run there may fail until it's fixed") and the done line reads "Terminal service restarted…".

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

ℹ️ No critical issues — one minor suggestion inline.

Reviewed changes

  • Rendered the post-restart state as a checklist: a successful restart now checks off both steps and offers a Done button instead of the previous "Terminal service restarted…" sentence.
  • Added a step-1 helper for the denied case (restartWillHelp === false) telling the user to turn the folder toggle off and on again, kept "Couldn't verify. Skip if already allowed." for the unverified case, and shortened that copy.
  • Dropped the fix dialog's now-unused close key and repointed the footer's done-state button at the done key.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@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: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: eb638740-7342-439b-ae51-14787c09d9f4

📥 Commits

Reviewing files that changed from the base of the PR and between 981d116 and 552a0a2.

📒 Files selected for processing (18)
  • src/main/computer/macos-computer-use-permissions.test.ts
  • src/main/computer/macos-computer-use-permissions.ts
  • src/main/daemon/daemon-folder-access-mismatch.test.ts
  • src/main/daemon/daemon-folder-access-mismatch.ts
  • src/main/daemon/daemon-folder-access-reset.test.ts
  • src/main/daemon/daemon-folder-access-reset.ts
  • src/main/ipc/pty-management.test.ts
  • src/main/ipc/pty-management.ts
  • src/main/macos-tcc-reset.test.ts
  • src/main/macos-tcc-reset.ts
  • src/preload/api/pty-bridge-stream-and-serialization.ts
  • src/preload/api/pty-management-api.ts
  • src/renderer/src/components/shared/MacFolderAccessFixDialog.test.tsx
  • src/renderer/src/components/shared/MacFolderAccessFixDialog.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/web/preload-api/web-terminal-api.ts
  • src/shared/daemon-adoption-telemetry.test.ts
  • src/shared/telemetry-daemon-event-schemas.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@pullfrog pullfrog 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.

ℹ️ No critical issues — one minor suggestion inline, plus a design question about what happens when the user declines the re-prompt.

Reviewed changes

  • Shared the macOS TCC reset: extracted readMacosBundleId and resetMacosTccPermission into src/main/macos-tcc-reset.ts and re-pointed the computer-use reset at them, so both remedies issue the same tccutil reset through the runProcessSync chokepoint (10s bound, failure returned as data).
  • Added the folder-access reset remedy: resetFolderAccessForDaemon clears Orca's TCC row for the denied folder class, has the app read the folder to raise the macOS prompt, then forces a fresh-daemon re-probe and emits reset_outcome_{allowed,still_denied,unknown} from main.
  • Extended the mismatch store: getDaemonFolderAccessTarget hands the remedy the stored path/class without emitting shown, and refreshDaemonFolderAccessProbe gained force — it waits out an older in-flight probe, then probes the entry left behind.
  • Wired the side-effecting IPC: a new pty:management:resetFolderAccess channel (user-click only) plus preload and web stubs, where the web client returns unsupported.
  • Renderer: the fix dialog gained a Reset permission action with busy/probed/failed states, a "Still blocked after the reset." line, and the reset_* telemetry actions.

ℹ️ A denied re-prompt after the reset silently leaves Orca with less access than before

The reset is the one action in this flow that removes a working grant. Clearing Orca's TCC row is what makes macOS ask again, but the only thing that re-establishes the grant is the user choosing Allow on the prompt promptByReadingFolder raises — and nothing detects or surfaces the Don't Allow outcome.

Technical details
# The reset can revoke Orca's own folder access with no recovery path

## Affected sites
- `src/main/daemon/daemon-folder-access-reset.ts:106-109` — after `resetMacosTccPermission` returns ok, the flow relies on the user allowing the prompt; a denial is indistinguishable from success at this point.
- `src/main/daemon/daemon-adoption-telemetry-event.ts:117-121` — if the app itself ends up denied, `hasDaemonPtyCwdDenialDiverged` is false, so the spawn path neither records new evidence nor clears the existing `stored` entry.
- `src/renderer/src/components/shared/MacFolderAccessFixDialog.tsx:116` — the dialog can therefore keep offering a `Reset permission` whose prompt is already denied, alongside a stale "Still blocked after the reset." line.

## Required outcome
- Declining the re-prompt must not leave the user strictly worse off, quietly. Either the reset flow detects the post-prompt denial and says so (e.g. "Orca is now denied this folder — enable it in System Settings"), or the copy warns that declining revokes Orca's own access and the button carries a confirmation.

## Open questions for the human (optional)
- Is the reset intentionally offered on a known-good app grant, given that a denied re-prompt is worse than not resetting? Is the checkbox-free flow acceptable because `reset_outcome_still_denied` is expected to catch it in the field?

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found in this delta. Not approving yet because the restartState / step-1 / resetState threads from the preceding reviews are still open on this PR.

Reviewed changes

  • Rewrote the denied case's step 1: the label is now "Re-allow Orca for your {{folder}}" and the helper states what Reset does and to click Allow when macOS prompts.
  • Demoted System Settings to a fallback: with restartWillHelp === false the footer starts as Cancel + Reset, and only swaps Cancel for Open System Settings once settingsIsFallback reports a reset that failed or came back still blocked.
  • Updated the dialog tests to the new footer states (the Files and Folders opener test moves to the unverified branch).

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H Jinwoo-H changed the title fix(macos): tell the user when Orca's terminal service can't read their folder fix(macos): tell the user when Orca's terminal service can't read their folder, and walk them through the fix Sep 21, 2026

@pullfrog pullfrog 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.

✅ No new issues found in these commits. Not approving yet because the prior step-1 checklist thread is still open (an unanswered probe plus a successful restart checks the row while its helper still reads "Couldn't verify"), and the focus-trigger and reset-revokes-grant concerns from earlier reviews are unaffected by this delta.

Reviewed changes

  • Renamed the probe verdict: restartWillHelp: boolean | null became freshDaemonAccess: 'allowed' | 'denied' | 'unknown' across the evidence store, the IPC reply, the dialog, and the reset-outcome telemetry map.
  • Removed the spawn-path probe: recordDaemonFolderAccessMismatch no longer forks a child, so the PTY spawn path is free of the probe; the focus-time poll's refreshDaemonFolderAccessProbe is now the only prober.
  • Fixed the restart-outcome latch: the module-level priorDenial was replaced by stored.outcomeReported, so a denial the same daemon later read back no longer produces a false restart_outcome_still_denied for the next daemon.
  • Made the shared TCC helpers async: readMacosBundleId and resetMacosTccPermission now run through runProcess, and the computer-use reset awaits them instead of blocking main on spawnSync.
  • Moved the notice latch into the store: one visibleScope/dismissedScopes pair with showNotice/retireNotice/dismissNotice, and the shown event is now emitted by the renderer when the toast is actually raised.
  • Keyed the fix dialog by daemon scope: extracted FolderAccessFix and mounted it with key={mismatch.daemonScope}, so a replacement daemon starts a fresh checklist instead of inheriting restartState/resetState (addresses the two open dialog-state threads).
  • Added a real-path probe-script test: daemon-folder-access-probe-script.test.ts executes the inlined child script against real directories (ok, missing, file-as-missing, chmod-denied) instead of mocking the spawn.

Verified locally: 143 main-side and 47 renderer tests pass across the 12 touched files, and pnpm run check:code-quality:changed reports 0 new findings.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • Made a forced probe always re-probe: refreshDaemonFolderAccessProbe(identity, { force: true }) now skips the settled-allowed shortcut in addition to the 5s interval, so a reset is always judged by a probe that ran after it; the old "settled true stays final under force" test became "probes again on a forced refresh even after a settled allowed".
  • Decoupled the poll's two answers: a rejected getCurrentDaemonMacTccAttributionHealth() now yields health: 'unknown' without nulling folderAccessMismatch, and a rejected re-probe is swallowed so the re-read folder evidence is still returned.
  • Suppressed the step-1 unverified helper once the restart is done, so a checked row no longer contradicts its "Couldn't verify" copy (resolves the prior inline thread).
  • Closed the fix dialog when the reset's re-read returns mismatch: null (daemon replaced mid-reset) instead of showing "Still blocked after the reset.", with the dialog tests updated.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

ℹ️ No critical issues — one minor suggestion inline. Not approving because the earlier focus-trigger concern (a spawn-recorded denial only surfaces on the next window focus) is unchanged by this delta.

Reviewed changes

  • Scoped the folder-access notice per folder class: daemonScope now digests daemonKey + cwdClass, so one daemon denied a second class mints a new scope (a new notice and remedy) instead of retitling the first one.
  • Derived the fix dialog from the latest verdict: the store dropped open/applyPollVerdict for openScope plus an unconditional applyVerdict; the dialog renders only while openScope === mismatch.daemonScope, so evidence that moves to another scope closes it rather than retargeting the title, checklist, and reset mid-remedy.
  • Restricted the permission reset to TCC-backed classes: added the shared MAC_TCC_FOLDER_CLASSES / isMacTccFolderClass, and a denied other-home/outside-home workspace now gets Cancel + Open System Settings instead of a reset that has no row to act on.
  • Bounded the permission prompt's read: promptByReadingFolder races the folder read against a 60s deadline, and skips the post-reset probe (emitting reset_outcome_unknown) when the macOS sheet is still up.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found in these commits. Not approving because the probed-state note from the prior review is unchanged.

Reviewed changes

  • Reworked the notice latch into a per-scope phase map: visibleScope + dismissedScopes became noticePhaseByScope: Map<scope, 'visible' | 'retired' | 'dismissed'> with a visibleNoticeScope helper; showNotice retires any other visible scope (Sonner keeps one toast per id), so a reconnect-blip re-show reads as the same notice rather than a new one.
  • Counted shown once per scope: the hook emits shown only when the scope was absent from the map, so a re-show after a transient null poll no longer inflates the denominator the affected-user rate is read against.
  • Dropped step 2's restart warning once the restart completes: the restartConsequence helper is suppressed when restartState === 'done', matching step 1.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found in these commits. Not approving because the probed-state inline from the previous review is unchanged by this delta.

Reviewed changes

  • Closed the fix dialog once its evidence is gone — applyVerdict(null) now clears openScope alongside the verdict, and FolderAccessFix no longer carries key={mismatch.daemonScope}: the dialog already unmounts whenever openScope !== mismatch.daemonScope, so a replacement daemon still opens with an unticked checklist. Tests cover both the cleared-evidence and same-scope-reopen paths.
  • Tied the preload cwd class to the shared enum — PtyManagementDaemonCwdClass is now an alias of DaemonPtyCwdClass rather than a copied literal union, so adding a class to DAEMON_PTY_CWD_CLASSES fails the folder-name switch at compile time. This closes the drift risk flagged in an earlier review.
  • Kept the folder-access toast up when the dialog opens — the Fix action calls event.preventDefault(); Sonner 2.0.7 runs the handler and then returns before deleteToast() when the click is prevented, so cancelling the dialog leaves the still-true notice on screen instead of latching its scope with nothing to show.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found in these commits. Not approving because the probed-state inline from the previous review is still open and untouched by this delta.

Reviewed changes

  • Ended the folder-access remedy with its evidence — applyVerdict now clears openScope whenever the incoming verdict belongs to a different scope and retires the visible notice on a null verdict, so a remedy that movement or clearing ended can no longer reopen when the original scope comes back, and the toast no longer lingers when a reset finds the evidence gone. The dialog guard collapses to !openScope and the hook drops its own retire step.
  • Cleared the reset failure once the grant lands — the reset_failed error line is suppressed while freshDaemonAccess === 'allowed', so a reset that failed before the user granted the folder in System Settings no longer reads as a live failure, and the checklist can show the one tick it earned.
  • Let each fix-dialog button report its own work — the footer's spinner and label now come from resetState / restartState rather than the shared busy, so the restart button no longer reads "Restarting…" while a reset is what is actually running.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

ℹ️ No critical issues — the prior probed-state inline is addressed; one residual doc nit inline. Not approving because the focus-trigger concern from the initial review and the reset-revokes-grant design question are unchanged by this delta.

Reviewed changes

  • Moved the app-side folder read off main's spawn path — enumerateDirectoryOnce is now async (fs.promises.opendir) with a sync twin for the daemon process, and reportDaemonPtyCwdVerdict is fire-and-forget (void), so an unanswered macOS prompt no longer holds main's event loop for the life of a spawn.
  • Stopped the reset from presenting a verdict it never measured — when the 60s prompt deadline passes, resetFolderAccessForDaemon now returns freshDaemonAccess: 'unknown' (emitting reset_outcome_unknown), and the dialog gates the "Still blocked after the reset." line on a denied verdict. This resolves the open inline thread.
  • Let the refresh own its skip policy — the focus-time poll now always calls refreshDaemonFolderAccessProbe; the settled-allowed and 5s-interval shortcuts live entirely inside the refresh, and the handler reports whatever evidence the refresh leaves behind.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

const FILES_AND_FOLDERS_PANE = { id: 'files-and-folders' } as const

type RestartState = 'idle' | 'busy' | 'done' | 'failed'
/** 'probed': the reset ran and a fresh probe answered; the verdict itself is on the mismatch. */

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.

ResetState documents 'probed' as "the reset ran and a fresh probe answered", but the new deadline path returns 'probed' with freshDaemonAccess: 'unknown' without ever probing (main emits reset_outcome_unknown). The dialog no longer misreads it, so this is the last piece of the prior concern. Update the doc — e.g. "the reset ran; the verdict it left is on the mismatch, unknown when the prompt went unanswered" — so the type contract matches what the code now guarantees.

@pullfrog pullfrog 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.

✅ No new issues found in this delta. Not approving because the ResetState doc nit from the prior review is still open, and the focus-trigger / reset-revokes-grant concerns are unchanged.

Reviewed changes

  • Removed the synchronous enumeration twin — enumerateDirectoryOnceSync is gone; the daemon's isCwdReadableByThisProcess now awaits the async enumerateDirectoryOnce before forking, so a folder read that blocks can no longer stall the daemon's event loop for every terminal it serves.
  • Re-pointed the readability test at node:fs/promises (opendir/close async, synchronous throw still covered), so cwdReadableByDaemon is exercised through the same helper the daemon now runs.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…ir folder

On macOS, a terminal daemon that survived an app update can be refused access to
a workspace under Documents, Desktop, or Downloads while the Orca app itself can
still read it. Terminals opened there die with "Operation not permitted" and
nothing on screen explains why. The daemon has reported `cwdReadableByDaemon` on
every create since #18043 and main has emitted `daemon_pty_cwd_denied` on proven
divergence since then; the field data says 1,438 users hit it in 21 days. What
was missing was the notice.

The verdict itself moves off `access()`. A grant-less probe on an affected
machine showed a TCC mode where `access(R_OK|X_OK)` passes on `~/Documents` and
`opendir` still fails, so the check now does what a shell listing its cwd does:
`opendirSync`, one `readSync`, `closeSync`. Only EPERM/EACCES reads as denial —
a missing path, a non-directory, or an unexpected error still reads as readable,
so a non-permission failure can never masquerade as one. The same probe is what
the app side compares with, through one oracle shared by the telemetry emitter
and the notice, so the spawn path reads the directory once.

Proven divergence now also records evidence in main: one entry, keyed by the
daemon's pid, start time and launch nonce, carrying an opaque digest of that
identity and the folder class. No path leaves main. The existing focus-time
`macTccAttribution` poll carries it to the renderer, which raises a second toast
latched per daemon scope: dismissed stays dismissed, and a restart mints a new
identity so the poll returns null and the toast clears with no post-restart
probe. If the replacement daemon is denied too, about 31% of cases, the next
spawn re-records under the new scope and the notice returns, now with the
re-allow sentence doing the work.

No new IPC channel, no daemon protocol field, no polling change, and nothing new
on the spawn path beyond one `opendir`. `daemon_folder_access_notice` counts
shown, dismissed and open_manage_sessions against `daemon_pty_cwd_denied` as the
denominator; `shown` is emitted from main the first time a scope leaves the IPC
handler, so the renderer carries no telemetry plumbing for it.
…ass reads back

A readable spawn in ~/code said nothing about a Documents denial but was
hiding the notice; retire the evidence only when the daemon reads a folder
of the class it was denied on.
The Manage Sessions restart confirmation still described the product as it was
before agents resumed themselves: it promised panes showing "Process exited"
that the user reopens by hand, and mentioned legacy-protocol sessions nobody
outside the daemon code can act on. Open terminals and agents come back on
their own now, so the old copy made a routine remedy sound like data loss.

It also called the thing a "daemon". The same restart is about to be offered
from a user-facing fix dialog, so both surfaces now say "terminal service", and
the confirm button is just "Restart".

The new body adds the one fact the old one never stated: terminals on remote
hosts are not affected. Translations of the two changed strings are dropped so
the five non-English locales fall back to English rather than keep showing copy
that is now wrong.
The folder-access toast told the user their terminal service could not read
Documents and then handed them a paragraph: restart from Manage Sessions, and
if that does not work, re-allow Orca in System Settings. Both halves were
guesses. Roughly a third of restarts do not fix it, and the user had no way to
know which case they were in before spending every open terminal on finding
out.

Main can now answer that. `daemon-folder-access-probe.ts` forks a short-lived
child of the app binary the same way the daemon itself is forked, runs one
opendir/readdir/closedir against the denied path, and prints a single JSON
line. macOS attributes a TCC grant to the process that forked the child, so a
child of the app running now answers exactly the question the running daemon
cannot: would a replacement daemon get in? The child goes through the shared
child-process wrapper, never a shell, with a 3s deadline, a 1KB output cap and
an environment scrubbed to PATH/HOME/TMPDIR. Every failure — timeout, bad
output, spawn error — reads as `unknown`, never as a verdict.

That answer rides out as `restartWillHelp` on the evidence the existing
focus-time poll already carries, and the toast becomes a title and two buttons:
Fix… and Not now. Fix opens a dialog with the two real steps. When the grant is
already in place, step one is shown as done and Restart is live. When it is
not, step one is open and Restart is disabled until it completes — which it
does by itself, because the poll re-probes while the answer is still no, and
returning from System Settings is the moment that lands. An unanswered probe
never accuses the user of a missing grant; it leaves both steps open.

Restart calls the management API directly rather than stacking the Manage
Sessions confirmation on top, since the dialog already states the consequence.
Success replaces the steps with a done line and takes the toast down; failure
says so inline and leaves the button usable.

System Settings opens through the existing developer-permissions pane opener,
which takes an id rather than a URL, with Files and Folders added to it. The
event's action enum now also counts fix_opened, settings_opened,
restart_clicked and — emitted from main when a replacement daemon's first spawn
lands in the folder class the previous one was denied on — whether the restart
actually worked.
…d no daemon

A daemon identity reads as null during any reconnect blip, and the poll reports that as
"no mismatch". The notice dismissed itself and then never showed again for that daemon,
because the once-per-daemon latch still held its scope. Only "Not now" should latch.
One line read like a stray warning. The toast now says who is blocked and what fails,
and still leaves the steps to the fix dialog.
…very other toast

"Fix" is the only button; the X dismisses. Sonner fires onDismiss for programmatic
dismissals too, so the post-restart takedown now goes through the store and the hook,
and only a user's X is counted as dismissed.
…ction in the footer

Buttons inside each step made the list look like a form, and a footer Close duplicated
the X. The footer now carries the active step's action, with a ghost Cancel; a probe
that could not answer says so under step 1 instead of showing a check.
A hedged sentence addressed to the user read like chat. On success both steps check
off and the footer offers Done; the unanswered-probe helper is a status, not advice.
…ngs as the fallback

Step 1 was labelled like a Settings task while the button did something else, with two routes
in the footer for one step. The denied state now names the step for what the reset does,
explains it under the step, and shows System Settings only after a reset fails or leaves
things blocked.
…survived

The stored denial is the prior denial, so a second copy of it outlived the
one event that retires it: a daemon that read its own folder back cleared the
entry but left the copy, and the next daemon's first denial was then reported
as a restart that had never happened.

Track the outcome on the entry itself, drop the spawn-path probe (ten denied
terminals forked ten probe children the focus-time poll re-runs anyway), and
stop emitting `shown` from a getter the reset path calls for data. The
renderer's toast latch is what decides a scope is shown, so it emits it.

Both accessors now read one identity-matched entry.
…t as a tri-state

`restartWillHelp: boolean | null` re-encoded a verdict the probe already
returns as a named union, so every reader had to remember that `false` meant
"Orca itself must be re-allowed" and `null` meant "no answer".

`freshDaemonAccess: 'allowed' | 'denied' | 'unknown'` says it, end to end
through main, the IPC payload, the preload mirror and the dialog. The reset's
outcome event becomes a lookup. No user-visible string changes.
…hree

Two refs in the hook and a field in the store tracked the same fact, and the
dialog reached the hook through a store field plus an effect just to take its
own toast down before sonner echoed the dismissal back.

The store now holds the visible scope and the scopes the user closed, and
exposes the three things that happen to a notice: it is shown, someone else
retires it, or the user dismisses it. The dialog calls retire directly and the
effect is gone. `settingsIsFallback` loses an argument that was always true at
its only call site, so it becomes the local it always was.
Two spawnSync calls with a ten-second timeout sat inside an async IPC handler,
so clearing a TCC row held main's event loop for as long as either binary took.

Both now run through runProcess. The computer-use caller that shared them was
already async, so it awaits them.
Every other test mocks the spawn away, so the minified child script — the one
piece that duplicates enumerateDirectoryOnce's errno mapping — had no oracle.
It now runs against a temp directory, an absent path, a file, and a directory
whose mode withholds it, which is skipped for root and on Windows.
All four callers that ask "is this evidence still this daemon's?" now go
through the same private accessor, so the rule the canonical path depends on
lives in one place.
…ke a forced re-probe always probe

A rejected attribution-health read nulled the folder evidence on the same poll, which the
renderer read as "cleared". A forced refresh after a reset returned early on an older
settled verdict. The dialog also closes when a reset finds the evidence gone, and stops
showing the unverified helper once the restart is done.
One daemon denied two protected folders kept one scope, so the toast, the
fix dialog, and the tccutil reset could each be about a different folder.
The store held an `open` flag and a mismatch frozen at the moment the toast
was raised, so the dialog could open on a stale verdict and its remedy state
could survive a close. It now keeps the latest verdict and the scope the user
opened, and the dialog is shown only while the two agree.
…eset

A workspace symlinked out of Documents or on an external volume can be denied
too, and the dialog offered a reset that main refuses. One shared list of the
TCC-backed folder classes now decides both.
An unanswered macOS sheet blocks the app's folder read for as long as the user
ignores it, and the fix dialog is modal and busy until that read returns. The
wait now ends after a minute and reports an unknown outcome rather than
probing under the sheet.
A reconnect blip reports no daemon, which takes the toast down and lets the
same scope raise it again. Both raises counted as separate notices, inflating
the denominator behind the affected-user rate. The two latches are now one
map from scope to phase, and the count follows first insertion.
Step two ticked green while its helper still warned that open terminals and
agents would restart, which had already happened.
Sonner deletes a toast after its action button runs unless the handler
prevents the event, and it does so without calling onDismiss. Clicking Fix
therefore took the notice off screen while the scope stayed latched as
visible, so cancelling the dialog left no way back to it.
…ng it

The five folder classes were hand-mirrored in preload behind a comment saying
preload cannot depend on main-only modules. The enum lives in src/shared,
which preload already imports from elsewhere, so the copy could drift.
A null verdict left the opened scope set, so the same scope coming back
remounted a checklist nobody had opened. Clearing it on a null verdict also
makes the dialog's scope key redundant, so it goes.
The footer swaps the reset for a restart as soon as a poll says the grant
landed, which can happen while the reset is still running. Both buttons read
their label off the dialog being busy at all, so the restart button appeared
spinning as "Restarting…" for a restart nobody had started.
"Couldn't reset the permission" stayed on screen after the user granted it in
System Settings and the probe read allowed, contradicting the ticked step
above it. Its sibling line was already gated on the same verdict.
Two ways out were missing. A reset that cleared the evidence closed the dialog
but left the toast on screen, because only the poll retired it; the store now
retires the notice whenever a verdict comes back null, so both callers get it
and the hook's own branch goes. And the opened scope survived a verdict for a
different scope, so the original one returning later reopened the dialog with
nobody having asked for it.
The app-side readability check moved from accessSync to opendir when the
notice was added. TCC lets accessSync through but gates opendir, so on a
machine that has never granted Orca the folder, spawning a terminal there
raised the macOS sheet and froze main until the user answered it. The read is
async now and the spawn no longer waits for it. The blocking variant keeps a
name that says so, and the reset module's own copy of the read is gone.
Two paths reached "Still blocked after the reset." with no verdict behind it:
an unanswered prompt, where the reset returns the verdict stored before it
ran, and a re-probe that could not answer. The reset now returns the same
access it reports to telemetry, and the line waits for a real denial.
…self

The poll handler re-implemented the refresh's own two guards, a null entry
and a settled allowed verdict, so each had to be kept in step by hand.
The daemon reads the requested cwd before forking a shell to report whether
it can list it. That read is the one macOS gates, so on a folder the daemon
is refused it could hold the daemon's event loop behind a prompt. It is
awaited now, which leaves the blocking enumerator with no callers.
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