Skip to content

fix(pty): restore macOS TCC attribution persistence - #12562

Merged
brennanb2025 merged 4 commits into
stablyai:mainfrom
shawnkoh:shawnkoh/fix-macos-tcc-attribution
Aug 5, 2026
Merged

brennanb2025 merged 4 commits into
stablyai:mainfrom
shawnkoh:shawnkoh/fix-macos-tcc-attribution

Conversation

@shawnkoh

@shawnkoh shawnkoh commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace the macOS login -> env -> shell chain with a clean Bash trampoline that exec -ls the configured shell, matching the working Ghostty launch shape.
  • Pass SHELL, shell paths, and all shell arguments positionally without interpolation.
  • Preserve custom and fallback shells, cwd, login semantics, disabled/non-macOS behavior, and preflight degradation.
  • Record a value-free macos-tcc-pty-spawn daemon event with wrapped or direct strategy for live diagnosis.

Fixes #8985.

Screenshots

No visual change.

Testing

  • pnpm lint — full repository lint not run; focused oxlint passed with denied warnings.
  • pnpm typecheck — full typecheck not run; pnpm run typecheck:node passed.
  • pnpm test — full suite not run; focused Vitest passed: 3 files, 160 tests.
  • pnpm build — full production build not run; isolated development Electron build launched successfully.
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Focused tests cover exact argv, custom/fallback shells, spaces, equals signs, disabled and non-macOS paths, preflight degradation, and spawn-strategy reporting.

Live macOS verification on the affected host:

  1. The isolated dev daemon recorded macos-tcc-pty-spawn with strategy=wrapped.
  2. The PTY process chain was login -> bash --noprofile --norc -> exec -l zsh; SHELL, cwd, and login argv were preserved.
  3. The first op vault list invocation prompted once and exited 0 after approval.
  4. A second invocation in the same PTY and a third invocation in a new PTY both exited 0 without another AUTHREQ_PROMPTING event.
  5. tccd returned an allowed persisted decision for both later processes.

AI Review Report

Reviewed every local user-terminal node-pty route: daemon primary, local primary, and Unix fallback. All continue through the centralized macOS wrapper after shell fallback resolution. Checked preflight fail-open behavior, positional argument safety, login-shell semantics, and daemon diagnostic privacy.

Cross-platform review confirmed that the wrapper and diagnostic wiring are macOS-gated; Linux and Windows retain direct spawning. No keyboard, UI label, provider, SSH, folder-workspace, path-separator, or Electron menu behavior changed.

Security Audit

  • Shell paths, SHELL, and arguments are positional parameters; no user-controlled value is interpolated into Bash source.
  • The fixed trampoline is constant and uses exec -l "$@".
  • The diagnostic records only wrapped or direct; it does not log usernames, shell paths, cwd, environment values, arguments, or terminal contents.
  • No dependencies, authentication flows, secrets, IPC schemas, or network behavior changed.

Notes

The behavior is macOS-specific. The live gate used the isolated com.stablyai.orca.dev build and verified persistence across both a new op process and a new PTY on macOS 26.5.1 with 1Password CLI 2.38.1.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5c42b3d6-9d41-4160-887a-0b37670d562b

📥 Commits

Reviewing files that changed from the base of the PR and between b924d3d and 476f2a2.

📒 Files selected for processing (1)
  • src/main/ipc/pty.test.ts

📝 Walkthrough

Walkthrough

macOS TCC shell wrapping now uses a positional Bash trampoline that preserves SHELL, shell paths, and arguments. Bash commands with --rcfile use a direct trampoline. PTY subprocess options include an optional callback that reports direct or wrapped strategy selection. Daemon PTY creation forwards this callback and logs the selected strategy on macOS. Tests cover wrapper commands, spawn failures, environment overrides, fallback shells, spaces, equals signs, dash-prefixed shell names, and inherited BASH_ENV.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the PTY fix that restores macOS TCC attribution persistence.
Description check ✅ Passed The description includes all required sections and documents the change, testing, security review, cross-platform review, and platform-specific notes.
Linked Issues check ✅ Passed The implementation addresses issue #8985 by restoring macOS TCC attribution, preserving shell behavior, and covering daemon and fallback PTY paths.
Out of Scope Changes check ✅ Passed The code and test changes remain within the linked issue scope of macOS TCC attribution and PTY shell-spawn behavior.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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.

shawnkoh and others added 3 commits August 4, 2026 20:06
Replace the env intermediary with a clean bash trampoline that execs the configured shell as a login shell. Keep SHELL, custom arguments, fallback shells, and unsafe characters positional.
Record wrapped versus direct daemon PTY strategy without private values so live TCC reports can distinguish launch behavior.
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@brennanb2025

Copy link
Copy Markdown
Contributor

Maintainer review complete. I confirmed the repeated macOS AppData prompt is caused by Orca TCC attribution—not normal 1Password CLI authorization or the reporter’s setup—and pushed the reviewed branch rebased onto current main at b924d3d6e3.

Review hardening added:

  • preserve Bash --rcfile behavior through the direct-exec path
  • use exec -- for dash-prefixed executable names
  • invoke the fixed Bash trampoline with -p so BASH_ENV, imported functions, and hostile SHELLOPTS cannot affect the pre-exec boundary
  • report direct/wrapped only after node-pty successfully spawns

Validation is clean: two independent review lanes, full typecheck and lint, 161 focused tests passed with only the two known deleted-cwd host cases skipped, and Electron QA with two fresh terminals. Both terminals had login → -/bin/zsh ancestry and emitted strategy:"wrapped"; the renderer console was clean. The measured cost is a one-time ~4–6 ms macOS terminal-start delta with no retained process or steady-state overhead.

Electron QA: two wrapped macOS PTY spawns

@brennanb2025

Copy link
Copy Markdown
Contributor

Follow-up review complete.

  • Fixed the stale integration assertion for the new macOS login-shell trampoline in 476f2a23f3.
  • Exact PTY IPC suite passed locally: 446/446.
  • Independent scoped review returned clean for correctness, shell argument safety, cross-platform behavior, regressions, and PTY startup/resource cost.
  • PR Checks are green, including shard 16 on Node 24 and 26, static analysis, typecheck, shell contracts, Git compatibility, and macOS/Linux/Windows native smoke.

No additional UI screenshot was taken because this follow-up is nonvisual and Electron QA was skipped.

@brennanb2025
brennanb2025 merged commit c4d5a53 into stablyai:main Aug 5, 2026
48 checks passed
@brennanb2025

Copy link
Copy Markdown
Contributor

Thanks for the PR!

@shawnkoh

shawnkoh commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the PR!

thanks for the super prompt review and merge!

@shawnkoh
shawnkoh deleted the shawnkoh/fix-macos-tcc-attribution branch August 5, 2026 08:04
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix(pty): restore macOS login shell attribution

Replace the env intermediary with a clean bash trampoline that execs the configured shell as a login shell. Keep SHELL, custom arguments, fallback shells, and unsafe characters positional.

* chore(pty): log macOS TCC spawn strategy

Record wrapped versus direct daemon PTY strategy without private values so live TCC reports can distinguish launch behavior.

* fix(pty): harden macOS TCC login trampoline

* test(pty): update macOS TCC spawn expectation

---------

Co-authored-by: Brennan Benson <[email protected]>
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.

[Regression] TCC 'access to other apps' data' prompt re-appears on every subprocess launch (op CLI) — regression of #6996 since ~1.4.139

2 participants