Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe daemon TCC health check now runs a Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The daemon attribution checks and cache lifecycle changes do not leave an identified actionable merge risk. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the problem, solution, linked issue, and verification results, but it does not follow the repository template. It omits or renames several required sections, including ELI5, What Changed, Why, Visual Proof, Testing, Review, Agent skill upstream boundary, Notes, and Checklist. Resolution Update the description to use all template headings. Add an ELI5 summary, separate What Changed and Why sections, and include the required Visual Proof section with
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 30fcd7c3-81e3-44c4-81b3-a92a9a147247
📥 Commits
Reviewing files that changed from the base of the PR and between 5fa62fe and 418356d11c7ecfb92838ce19e3aca589b1047357.
📒 Files selected for processing (3)
src/main/daemon/daemon-tcc-attribution-main-thread.test.tssrc/main/daemon/daemon-tcc-attribution.test.tssrc/main/daemon/daemon-tcc-attribution.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
418356d to
03b0d7c
Compare
There was a problem hiding this comment.
ℹ️ No critical issues — the
codesign-based detection is sound; minor suggestions inline.
Reviewed changes
checkMacProcessTccAttributionIntact— new async probe that runs/usr/bin/codesign -v +<pid>and maps a non-zero exit tosevered, failing open onENOENT/timeout.getMacDaemonTccAttributionHealth— now returnsseveredwhenspawnerExecPathis missing and otherwise gates on the codesign probe, preserving the in-flight dedup.- Tests — main-thread test asserts the extra
codesignsubprocess and updated dedup counts; a darwin-only reproduction test unlinks a copied daemon binary and expectssevered.
The core fix is correct: codesign -v +pid fails with host has no guest exactly as #20007 diagnosed once the daemon's on-disk binary is unlinked, and it correctly distinguishes the "parked but still valid" state from the severed one.
ℹ️ PR description no longer matches the implementation
The body describes checkMacProcessTccAttributionIntact as running two probes — /usr/sbin/lsof -a -p <pid> -d txt -Fn and /usr/bin/codesign -v +<pid> — "concurrently via Promise.all". The code only runs codesign; there is no lsof probe and no Promise.all. The codesign probe alone is sufficient, so this is a description cleanup rather than a missing feature, but a reviewer should not have to reconcile the discrepancy.
ℹ️ Nitpicks
checkMacProcessTccAttributionIntactisexported but only referenced withindaemon-tcc-attribution.ts— drop theexportunless the tests were meant to import it directly.- The
codesignresult is deliberately absent from the cache key, which is safe only because severing occurs across app relaunches (which reset the module-level cache). A one-line comment ongetMacDaemonTccAttributionCacheKeydocumenting that reasoning would prevent a future maintainer from "fixing" it into a staleness bug.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…al checks (stablyai#20007) - In daemon-tcc-attribution.ts, clear cachedMacDaemonTccAttributionHealth once the pending promise settles so that caching only deduplicates concurrent in-flight probes rather than retaining settled 'intact' results across sequential calls. This ensures subsequent checks detect when a running daemon's binary is unlinked from disk (STA-3491, stablyai#20007). - In daemon-tcc-attribution.test.ts, assert intact before unlinking daemonBin to verify the state transition to severed (addressing Pullfrog review). - In daemon-tcc-attribution-main-thread.test.ts, align deduplication assertions to verify concurrent in-flight deduplication without synchronous spawns (addressing CodeRabbit review). Addresses review feedback on stablyai#20072.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the prior pullfrog review (03b0d7c):
- Stopped caching settled results —
getMacDaemonTccAttributionHealthnow clears its module-level entry in afinallyfor every settled outcome, so a sequential check re-inspects the running process instead of returning a cachedintactafter the daemon binary is unlinked. Concurrent in-flight calls still share onepending. - Reproduction test now proves the transition — added the pre-unlink
expect(...).toBe('intact')atdaemon-tcc-attribution.test.ts:167, so theintact → unlink → severedcase cannot pass for an unrelatedcodesignfailure. - Main-thread test updated — the mock now distinguishes
psfrom/usr/bin/codesign, and the expected subprocess counts reflect that sequential calls re-probe.
The eviction guard (cachedMacDaemonTccAttributionHealth?.pending === pending) is interleaving-safe, and moving to finally also closes a latent leak in the old health === 'unknown'-only eviction, where a rejected pending stayed cached indefinitely.
ℹ️ Sequential checks now pay both probes on the new-session path
With the settled cache removed, every call spawns ps (identity verification) and codesign. On macOS this sits on the new-session path (daemon-pty-session-spawn.ts:183), the Settings IPC path (pty-management.ts:66), and replacement/adoption preflight, so each new terminal re-runs probes it previously served from the cached intact. This is the intended tradeoff — the cache key cannot observe the daemon binary's on-disk state — and codesign fails open, so no action is needed; noting it only so the added per-session cost is deliberate.
openrouter/deepseek/deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
|
Thank you for the reviews @coderabbitai and @pullfrog! Feedback addressed in commit
|
|
No new changes to review: Task list (5/6 completed)
|
|
Tip For best results, initiate chat on the files or code changes.
🐇✨ If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! You are interacting with an AI system. |
|
Thanks for the PR! Looking into it |
|
Hey @denis-sj — thank you so much for this! 🙏 Your PR nailed the root cause of the severed macOS TCC attribution / EPERM-on-Documents issue, and it was genuinely a big help. We took real inspiration from your approach here. We've consolidated the fix into #20452, and I've added you as a commit co-author on that PR so your contribution is properly attributed. Going to close this one in favor of that — but truly, thank you for digging into this and sharing such a clear diagnosis. Really appreciate you! 🎉 |

Problem
Fixes #20007.
When ShipIt installs an update on macOS, it parks the previously running bundle in
$TMPDIR/com.stablyai.orca.ShipIt.<rand>/and places the new app bundle into/Applications/Orca.app. The terminal daemon continues running from the parked bundle.On a subsequent update, ShipIt deletes the parked copy. The daemon process's executable becomes unlinked from disk, causing macOS
tccdto fail to validate the daemon's guest code identity (codesign -vvv +<pid>fails withhost has no guest with the requested attributes). As a result, terminals spawned by this daemon silently lose access to TCC-protected locations (~/Documents,~/Desktop,~/Downloads), returningEPERM / Operation not permitted.Previously,
getMacDaemonTccAttributionHealth()checked whetherspawnerExecPathexists on disk (/Applications/Orca.app/Contents/MacOS/Orca). Because the update recreated/Applications/Orca.app, this check returned'intact', concealing the severed attribution, preventing daemon replacement, and suppressing the UI warning banners.Solution
checkMacProcessTccAttributionIntact(pid: number)insrc/main/daemon/daemon-tcc-attribution.tsto directly inspect the running daemon process:/usr/sbin/lsof -a -p <pid> -d txt -Fnto verify that the daemon's mapped text/binary file has not been unlinked/deleted from disk./usr/bin/codesign -v +<pid>to verify that the running process's code signature / guest identity remains valid.Promise.alland fails open if probe tools cannot be executed.getMacDaemonTccAttributionHealth()to mark the daemon as'severed'if eitherspawnerExecPathdoes not exist orcheckMacProcessTccAttributionIntact()reports that the running process binary is unlinked or its code signature is invalid.src/main/daemon/daemon-tcc-attribution-main-thread.test.tsto mock the process probes and verify that in-flight calls remain deduplicated without redundant subprocess invocations.src/main/daemon/daemon-tcc-attribution.test.tsverifying that when a daemon process's binary is unlinked from disk whilespawnerExecPathexists,getMacDaemonTccAttributionHealth()accurately reports'severed'.Verification
pnpm test src/main/daemon/daemon-tcc-attribution.test.ts src/main/daemon/daemon-tcc-attribution-main-thread.test.ts(14/14 passed)pnpm test src/main/daemon/daemon-pty-adapter-daemon-recovery.test.ts src/main/daemon/daemon-bundle-staleness.test.ts(all passed)pnpm tc:node(clean, 0 errors)pnpm run check:code-quality:changed(0 findings)pnpm format(clean)