Repository navigation
Ignore host xattrs for local filesync import identity - #13389
Merged
Merged
Conversation
tiborvass
approved these changes
Jun 10, 2026
sipsma
force-pushed
the
codex/debug-filesync
branch
from
June 10, 2026 01:19
d5cd0c4 to
c33bc65
Compare
A macOS/Colima repro with a Maven-like cache showed a surprising pattern: the first warm import of an unchanged host directory still performed a full copy, while the second warm import reused the copied ref. The instrumentation showed that copy itself was layercopy work, and that the first warm run missed reuse because the computed content hash changed after the cold run. The root cause is that local import identity included host xattrs that are not actually part of the Linux mirror/ref state. On cold add/modify paths filesync hashed the remote client stat, which can include macOS xattrs such as com.apple.provenance. The mirror then tried to write those xattrs best-effort, but Linux rejects non-user namespace names. On the warm unchanged path, directory digests were recomputed from the mirror stat, where those xattrs were absent, so the same host directory produced a different content hash and forced a new layercopy. Make the local import contract explicit: host xattrs are not source identity. Normalize local import stats by dropping xattrs at the client boundary, remove xattrs from filesync stat hashing, stop applying source xattrs to the mirror, and disable xattr copying from the mirror into the final immutable ref so the private mirror content-hash xattr does not leak. Version the private file-content hash xattr to user.daggerContentHash.v2 and lazily repair missing v2 values by hashing the mirror file. Also add targeted OTel spans and layercopy counters around contenthash search/checksum, filesync copy/ref handling, and layercopy traversal/copy work. Those spans split the prior opaque copy section into checksum, search, ref reuse, layercopy, commit, metadata, and copy-stat subparts. Validated with: go test ./engine/client ./engine/filesync ./engine/contenthash ./util/layercopy; git diff --check; rebuilt the dev engine with ./hack/dev true; pruned both stable and dev engine local caches; reran the Colima repro. Before the fix warm1 did a full copy (~32s copy/layercopy). After the fix cold copied once, warm1 reused the copy ref with copy ~0.2s/filesync ~7.5s, and warm2 matched warm1. Signed-off-by: Erik Sipsma <[email protected]>
Remove the temporary OTel spans and copy/contenthash counters that were added to diagnose the local filesync copy path. The first commit still contains the production fix: local import identity no longer depends on host xattrs that cannot round-trip through the Linux engine mirror, and the final ref copy disables mirror-private xattrs. Signed-off-by: Erik Sipsma <[email protected]>
sipsma
force-pushed
the
codex/debug-filesync
branch
from
June 10, 2026 01:20
c33bc65 to
357e379
Compare
sipsma
marked this pull request as ready for review
June 10, 2026 01:21
marcosnils
pushed a commit
that referenced
this pull request
Jun 10, 2026
* fix(filesync): ignore host xattrs for local import identity A macOS/Colima repro with a Maven-like cache showed a surprising pattern: the first warm import of an unchanged host directory still performed a full copy, while the second warm import reused the copied ref. The instrumentation showed that copy itself was layercopy work, and that the first warm run missed reuse because the computed content hash changed after the cold run. The root cause is that local import identity included host xattrs that are not actually part of the Linux mirror/ref state. On cold add/modify paths filesync hashed the remote client stat, which can include macOS xattrs such as com.apple.provenance. The mirror then tried to write those xattrs best-effort, but Linux rejects non-user namespace names. On the warm unchanged path, directory digests were recomputed from the mirror stat, where those xattrs were absent, so the same host directory produced a different content hash and forced a new layercopy. Make the local import contract explicit: host xattrs are not source identity. Normalize local import stats by dropping xattrs at the client boundary, remove xattrs from filesync stat hashing, stop applying source xattrs to the mirror, and disable xattr copying from the mirror into the final immutable ref so the private mirror content-hash xattr does not leak. Version the private file-content hash xattr to user.daggerContentHash.v2 and lazily repair missing v2 values by hashing the mirror file. Also add targeted OTel spans and layercopy counters around contenthash search/checksum, filesync copy/ref handling, and layercopy traversal/copy work. Those spans split the prior opaque copy section into checksum, search, ref reuse, layercopy, commit, metadata, and copy-stat subparts. Validated with: go test ./engine/client ./engine/filesync ./engine/contenthash ./util/layercopy; git diff --check; rebuilt the dev engine with ./hack/dev true; pruned both stable and dev engine local caches; reran the Colima repro. Before the fix warm1 did a full copy (~32s copy/layercopy). After the fix cold copied once, warm1 reused the copy ref with copy ~0.2s/filesync ~7.5s, and warm2 matched warm1. Signed-off-by: Erik Sipsma <[email protected]> * chore(filesync): remove debug copy tracing Remove the temporary OTel spans and copy/contenthash counters that were added to diagnose the local filesync copy path. The first commit still contains the production fix: local import identity no longer depends on host xattrs that cannot round-trip through the Linux engine mirror, and the final ref copy disables mirror-private xattrs. Signed-off-by: Erik Sipsma <[email protected]> --------- Signed-off-by: Erik Sipsma <[email protected]>
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
dagger 0.21.5 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## v0.21.5 - 2026-06-10 ### Added - Added expand option to container.exists by @alexcb in dagger/dagger#13310 - Support both Dang v1 and v2, routed by module engineVersion by @vito in dagger/dagger#13388 ### Changed - Prune local cache during disk pressure by @sipsma in dagger/dagger#13375 - Persist trivial core objects by @sipsma in dagger/dagger#13387 ### Fixed - Correct namespaced type-name mangling and cross-dependency interface dispatch in Dang by @vito in dagger/dagger#13377 - Surface exec errors correctly on the Bun runtime in the TypeScript SDK by @marcosnils in dagger/dagger#13395 - Ignore host xattrs for local filesync import identity by @sipsma in dagger/dagger#13389 - Don't shallow-clone the user's repo for git telemetry labels by @marcosnils in dagger/dagger#13363 - Preserve pending lazy container parents by @sipsma in dagger/dagger#13365 - Preserve withChanges parent layers by @dagger-codex[bot] + @shykes in dagger/dagger#13342 - Treat incomplete image metadata as cache miss by @sipsma in dagger/dagger#13346 - Cache registry image metadata by @dagger-codex[bot] + @shykes in dagger/dagger#13341 - Don't require id field for interface conformance in Dang by @vito in dagger/dagger#13318 - Use module-local check names for scale-out by @dagger-codex[bot] + @tiborvass in dagger/dagger#13329 - Fix snapshot owner lease attach/remove race by @sipsma in dagger/dagger#13321 - Follow source symlinks when copying directory contents in layercopy by @marcosnils in dagger/dagger#13326 ### What to do next? - Read the [documentation](https://docs.dagger.io) - Join our [Discord server](https://discord.gg/dagger-io) - Follow us on [Twitter](https://twitter.com/dagger_io) </pre> <p>View the full release notes at <a href="https://github.com/dagger/dagger/releases/tag/v0.21.5">https://github.com/dagger/dagger/releases/tag/v0.21.5</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!11205
This was referenced Nov 13, 2026
sipsma
pushed a commit
that referenced
this pull request
Nov 17, 2026
…digest (#15168) * filesync: keep a symlink's permission bits out of a host directory's digest A symlink has permission bits of its own on macOS, taken from the umask it was created under. On Linux a symlink is always 0777. The client sent the host's bits, the engine hashed them, and the mirror's link was 0777 either way, since Linux has no bits to set on it. So one tree had one digest from a macOS client and another from a Linux client: $ ln -s notes.md tree/latest.md # macOS, umask 022: lrwxr-xr-x $ dagger -m core api call host directory --path tree digest sha256:523803c6... # the same tree from a Linux client, or with the link made under umask 000 sha256:e1ee8b8a... This is the case #13389 fixed for host xattrs: metadata that cannot round-trip through the Linux mirror is not source identity. Send 0777 for a symlink from the client, next to the uid, gid and xattrs it already normalizes. Hash a symlink as 0777 in the engine too, so a client older than this change gets the same digest: the engine accepts clients back to v0.19.0. A file's and a directory's bits are still sent and hashed. A macOS client's digest of a tree with symlinks changes once. A Linux client's does not. Fixes #15167 Signed-off-by: Dan Shaw <[email protected]> * changie: add the pull request number Signed-off-by: Dan Shaw <[email protected]> * changie: use the entry written by changie new Signed-off-by: Dan Shaw <[email protected]> --------- Signed-off-by: Dan Shaw <[email protected]>
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.
Summary
This PR makes local filesync imports ignore host xattrs as source identity.
The motivating repro was a Maven-like cache directory on macOS/Colima where an unchanged host directory behaved oddly:
Temporary instrumentation showed the first warm run was not slow because layercopy randomly got slower. It missed reuse because the computed local import content hash changed after the cold run.
Root Cause
The local import hash included xattrs from the remote/client stat, but those xattrs were not faithfully materialized in the Linux engine mirror.
On macOS, the test tree had
com.apple.provenancexattrs. During cold add/modify handling, filesync hashed the remoteupperStat, so those xattrs contributed to the directory digest. The mirror then attempted to write source xattrs best-effort, but Linux rejects non-user.*names likecom.apple.provenance.On the next unchanged run, directories went through
GetPreviousChange, which recomputed the digest from the mirror/lower stat. The mirror did not have those macOS xattrs, so the same host directory produced a different content hash. That caused contenthash reuse to miss and forced another full layercopy. The following warm run then reused the new xattr-free digest.Changes
user.daggerContentHash.v2.Validation
Ran focused tests:
go test ./engine/client ./engine/filesync ./engine/contenthash ./util/layercopy git diff --checkRebuilt and ran a dev engine with Colima:
./hack/dev trueThen pruned stable and dev engine local caches and reran the same repro.
Before this change, the first warm run still did a full copy, with copy/layercopy around 32s. After this change:
63.84s1m3s17.7s16.9s8.13s7.5s0.2s7.79s7.3s0.2sEngine logs confirmed warm1 and warm2 reused the same copied ref.
Notes
This intentionally treats host xattrs as outside the local import content contract. That avoids making cache identity depend on OS-specific metadata that cannot round-trip consistently through the Linux engine mirror and final refs.