Repository navigation
Conversation
AbirAbbas
added a commit
that referenced
this pull request
Oct 29, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d apply macOS 13+ attaches com.apple.provenance (11 bytes) to every file, directory and symlink a provenance-tracked process writes, which is every binary built on the Mac and everything it starts. Portable review/apply refused any path with any extended attribute, so private task roots could never be reviewed or applied on a Mac. On darwin the check now allows exactly one attribute: com.apple.provenance with an 11-byte value, read no-follow into fixed buffers, with the list read again afterwards. Every other attribute (quarantine, macl, FinderInfo, a resource fork, metadata:*, any user name) still refuses with the same message. Apply writes new inodes, which get their own provenance, so nothing of the project is lost. The darwin ACL check also refuses ACL entry lines explicitly: with an attribute present, ls -l prints '@' instead of '+', so the '+' branch never fired and only the line count caught an ACL. Linux keeps its size-only check unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ipping on a tracked binary Review round 1: an untracked process can store any 11 bytes under com.apple.provenance, and apply does not carry them. Say plainly, in the code and the manual, that the attribute is outside the portable contract whoever wrote it, and that an applied file gets the provenance macOS gives it. The provenance tests skipped whenever a fixture had no attribute. A tracked test binary tags everything it writes, so they now fail in that case and skip only when the test binary itself carries no provenance. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
force-pushed
the
fix/darwin-provenance-apply
branch
from
October 29, 2026 23:19
0174c83 to
b289cad
Compare
Collaborator
Author
|
Closing unmerged: the Mac push stopped early to save usage. What this fixes and what is left is tracked in #2052. The branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
On macOS, reviewing or applying a private task root refused every file with "portable apply cannot preserve extended attributes or access-control metadata". That covers
/task review N slotand/task apply N slot, withCODEAF_PROTOTYPE_WORKSPACE_OWNERSHIP=1or a chat with a saved private-task policy.macOS 13 and later attaches the system attribute
com.apple.provenanceto every file, directory and symlink that a provenance-tracked process writes. That includes every binary built on the Mac and everything it starts, so the engine and its tools tag all their output.review_metadata_unix.gorefused any path with any extended attribute (Llistxattrsize > 0).Measured on the Mac (macOS 15.6, APFS):
01 02 00followed by 8 id bytes).xattr -w,-wxand-dreturn 0 and the value stays.TestTaskWorkspace*,TestPlanBacked*) fail there because of it. With test binaries that carry no provenance, all 30 pass.Change
com.apple.provenancewith an 11-byte value.macl, FinderInfo (even zeros), a resource fork (also through..namedfork/rsrc), everymetadata:*name, and any user name.ls -lprints@and not+. With provenance on every path, the+branch never fired, and ACLs were caught only by the line count. The listing check now also refuses any ACL entry line explicitly (indented,N: …). The line-count, failure and batching rules are unchanged.review_metadata_linux.go, with the same syscalls, order, errors and text. Other platforms are unchanged.Tests
internal/taskcopy/review_metadata_darwin_test.go:TestPortableMutationAllowsDarwinProvenance: a file, a directory, a symlink, a dangling symlink and a root, each with real 11-byte provenance.TestPortableMutationRefusesOtherDarwinXattrsTestPortableMutationRefusesDarwinResourceFork: the fork refuses, and its bytes are intact afterwards.TestPortableMutationRefusesDarwinACLBesideProvenance" 0: fake"and a name with a newline still pass.TestPortableDarwinXattrDecision: unit tests over exact name and size, every errno, a race between the two list reads, and bounded calls.TestPortableDarwinACLListing: unit tests on captured listings.TestPortableMutationRefusesNativeDarwinMetadataandTestPortableMutationPreflightBatchesDarwinPathsare unchanged, and now pass on the Mac.internal/session/task_workspace_metadata_darwin_test.go:TestTaskWorkspaceApplyWithDarwinProvenance: folder and repository. Review and apply carry the exact reviewed bytes, and the private copy is kept.TestTaskWorkspaceApplyRefusesDarwinQuarantineTMPDIRfirst, because the Mac's symlinkedTMPDIRbreaks session workspace tests for a separate reason.Six subcases skip on this Mac, and that is expected. The kernel drops an all-zero FinderInfo write, and it refuses or drops an empty resource-fork write. The decision unit test covers those names.
Gates (on the Mac, Go 1.26.5)
gofmt;go vet ./internal/taskcopyon darwin andGOOS=linux;GOOS=linux go build ./internal/taskcopy: clean.internal/taskcopypackage: no new failures against the Mac baseline for app/v3 12dadd6, and the 2 R2 tests are fixed. The remaining 22 failures are the known symlinked-TMPDIR fixtures, the same names as the baseline.TMPDIR, all 28 R2 session tests plus the 2 new ones: pass. On app/v3 they fail with the extended-attributes refusal. Under the default (symlinked)TMPDIR, the 2 new session tests pass too.go test -count=1 -p 6 ./..., compared by test name with the baseline: pending (queued behind the machine-wide heavy-job lock, which waits for the Mac performance baseline).TestAWarmNoSendsBackToThePlanWithTheWordsAndAsksAgain, a 10 s timing wait) failed; it passes 3 of 3 times on the Mac on this branch and on app/v3, and passed when the failed shards were rerun.Manual verification (real terminal chat)
On an isolated home with
CODEAF_PROTOTYPE_WORKSPACE_OWNERSHIP=1, the realcodeaf chatran in a private tmux terminal./task BASH[printf r2-fixed > result.txt]was sent to a scripted local model, and the worker wroteresult.txtin the private root. That file carriescom.apple.provenance, because the engine is a locally built binary./task review 1 workresult.txtand "Apply this root: /task apply 1 work"/task apply 1 workresult.txtholdsr2-fixedresult.txtReview and known limits
There were two adversarial Codex review rounds. Both explicitly tried to break the allowlist.
What was tried, and the verdicts:
Pre-existing limits, not widened here. The native metadata checks are not atomic:
Lstatis not detected.One new variant applies to the tolerated attribute: provenance grown from 11 bytes to a larger value between the value read and the second list read is not seen, because the second read checks names only. Only an untracked process can do that.
Round outcomes:
🤖 Generated with Claude Code