Repository navigation
fix(worktrees): preserve inherited ACLs on APFS - #146586
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 8:20 PM ET / September 13, 2026, 00:20 UTC. ClawSweeper reviewWhat this changesPreserves inherited macOS filesystem permissions by falling back to Git checkout when APFS directory cloning cannot safely retain them, with native regression coverage and documentation. Merge readiness✅ Ready for maintainer review This remains a useful fix: fetched main still lacks ACL eligibility checks, and no introduced blocking defect was found. The maintainer-protected PR should remain open for normal landing. Priority: P2 Review scores
Verification
How this fits togetherManaged worktrees give agent tasks independent Git checkouts. Their filesystem backend can clone cached source templates for speed, while Git owns registration, indexes, and fallback checkout. flowchart TD
A[Worktree creation or restore] --> B[Inspect destination and template ACLs]
B -->|Eligible| C[APFS directory clone]
B -->|Inheritable or unknown| E[Git checkout]
C --> D[Recheck ACL policy]
D -->|Accepted| F[Independent registered worktree]
D -->|Rejected| G[Clean cloned destination]
G --> E
E --> F
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +89, Tests +166, Docs +2. Total +257 across 5 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep permission inheritance with Git and retain native cloning only for eligible private templates and destinations. Do we have a high-confidence way to reproduce the issue? Yes: create an accelerated APFS worktree beneath an inheritable ACL and compare descendant ACLs with an unaccelerated Git checkout. Current source and Apple's contract support this path; native execution was reported by the author, not repeated here. Is this the best way to solve the issue? Yes: rejecting unsafe acceleration through the existing Git fallback is narrower and more maintainable than recursively rewriting ACLs after cloning. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 94a56b2f78fb. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Related: #146401 and #146288.
What Problem This Solves
Fixes inherited ACL permissions being omitted from descendant files and directories when managed APFS worktrees use directory-clone acceleration.
User Impact
Worktree locations that rely on ACL inheritance now use normal Git checkout and receive the same permissions as an unaccelerated worktree. ACL-free locations and destination parents with only non-inheritable ACL entries retain native cloning. No new configuration is required.
Why This Change Was Made
Apple's directory clone can inherit an ACL at the new root while omitting inheritance below it. Git content and mode validation does not detect that difference. Check destination ACL eligibility on every selection, reject ACL-bearing template roots, and recheck the parent/new root around the admitted native operation. Unknown ACL metadata also uses the existing Git fallback. Git owns file creation and inheritance; this change does not introduce an ACL-repair pass or another lifecycle owner.
The inline documentation now cites Apple's warning and XNU's unfinished descendant-inheritance note, records the known limitation without inventing Apple's complete rationale, and explains why an admitted native clone must settle before cancellation recovery. The ACL reader also documents Darwin's empty-ACL/ENOENT ambiguity and its unusual iteration return values.
Evidence
pnpm openclaw worktrees createcalls passed with isolated state: ACL-free clones shared APFS data blocks with distinct inodes, inherited ACLs matched normal Git checkout on the root/nested directory/file/symlink, and a non-inheritable parent ACL retained cloning and independent writes.