Repository navigation
Description
Describe the bug
A package that contains in-repo symbolic links gets a different content hash on Windows from the one recorded on Linux or macOS, so apm install --frozen fails on Windows with a lockfile generated elsewhere. Enabling symlinks for Git on Windows (Developer Mode plus core.symlinks=true in the user's global config) doesn't help.
microsoft/aspire-skills@v0.0.4 (commit 851c8c1f6d059462853da6d9434e3e1375c9e23d) shows it: it has 74 mode-120000 entries (70 under .github/plugins/, plus four skills/*/evals/fixtures directory links).
- On Linux, the cache checkout has real links, and copying the tree into
apm_moduleswithout preserving symlinks turns each one into a real copy of its target. The recorded hash issha256:9328e637230ce4c0f615e619254a3545dcaa8d36f446551fd436f0e4a4c90d8a. - On Windows, the cache checkout's own
.git/configholdssymlinks = false, so Git writes each link as a small text file holding the target path (for example.github/plugins/aspire-skills/.claude-plugin/plugin.jsoncontains../../../../.claude-plugin/plugin.json). The hash issha256:5ef3cc66f64719c5ddad3e67f1bfd1bccd9760020e416a8797ed9d8a486e1ed3.
The cause appears to be that APM's Git environment hides the user's global and system config (GIT_CONFIG_GLOBAL/GIT_CONFIG_SYSTEM set to the null device). With no visible core.symlinks, Git for Windows writes symlinks = false into every repository it creates. Reproduced outside APM:
rem Global config has core.symlinks=true.
rem t1 gets no local core.symlinks, so it inherits true.
git init t1
set GIT_CONFIG_NOSYSTEM=1
set GIT_CONFIG_GLOBAL=NUL
rem t2 gets symlinks = false in its local config.
git init t2A command-scope value does survive. Setting GIT_CONFIG_COUNT=1, GIT_CONFIG_KEY_0=core.symlinks, GIT_CONFIG_VALUE_0=true before apm install makes Windows produce the Linux hash. A repository-local core.symlinks=true in the consuming project does not.
To Reproduce
On Windows with Developer Mode on and git config --global core.symlinks true:
- Create a project whose
apm.ymlhas onlymicrosoft/aspire-skills#v0.0.4underdependencies.apm. - Run
apm installwith an empty cache (APM_CACHE_DIRpointed at a new folder). - The lockfile records
content_hash: sha256:5ef3cc66…. On Linux the same steps recordsha256:9328e637…. - With a lockfile from Linux,
apm install --frozenon Windows fails:
[x] Failed to install APM dependencies: Content hash mismatch for microsoft/aspire-skills: expected sha256:9328e637230ce4c0f615e619254a3545dcaa8d36f446551fd436f0e4a4c90d8a, got sha256:5ef3cc66f64719c5ddad3e67f1bfd1bccd9760020e416a8797ed9d8a486e1ed3. ...
- Repeat step 2 in a fresh cache with the three
GIT_CONFIG_*variables above set: the hash issha256:9328e637….
apm install --update fails with the same mismatch on Windows.
Expected behavior
The package content hash is the same on every platform for the same commit, so a lockfile generated on Linux (for example by Renovate) verifies on Windows. Either of these would do it:
- Keep the user's
core.symlinkssetting when isolating Git config, as is already done for command-scope entries. - Make the materialised tree, or the hash, independent of whether Git wrote links. For example, resolve in-package links from the Git tree rather than the working copy, or hash mode-120000 entries by their target content.
There's also no APM option or APM_* environment variable to control this today, so the GIT_CONFIG_* variables are the only workaround.
Environment
- OS: Windows 11 (build 26300), Git 2.56.0.windows.4. Linux comparison on Ubuntu 24.04 (WSL2).
- APM Version: 0.35.0 on both
- Python Version: bundled binary
Additional context
The lockfile was generated on Linux. Possibly related to #3110, which is also about repositories with in-repo symlinks.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
danielmeppiel commentedon Nov 10, 2026
Decision: approve
Area: project
Scope: Make packages with in-repo symlinks materialize to the same bytes and content_hash on Windows as on POSIX by pinning core.symlinks=true in APM's isolated Git clone and checkout configuration, and when the host cannot create a symlink, fail with a clear diagnostic naming the package and the Windows symlink requirement instead of a later content-hash mismatch.
Done when: Tests show APM's Git invocations for clone, checkout and the uncached fallback carry core.symlinks=true; on Windows with symlink capability a fixture package with an in-repo symlink yields the POSIX content_hash; when link creation is not possible the install fails before hashing with the diagnostic and a nonzero exit; packages without symlinks are unaffected; docs state the Windows requirement; the tests fail on current main.
Out of scope: APM-owned dereferencing of links from Git objects; content-hash normalization; changes to user or system Git configuration; links that escape the package; line-ending determinism (#3270, #3368).
Review contact: Daniel Meppiel (@danielmeppiel)
danielmeppiel commentedon Nov 10, 2026
The
apm-scope:v1record above was approved by Daniel Meppiel (@danielmeppiel) at Gate B on 2026-11-10 in the coordinator session of the issue-reduction program. It is the scope a fix for this issue will be reviewed against.Review contact: Daniel Meppiel (@danielmeppiel).
Generated by autopilot-issue-triage-worker. This comment is AI-generated and may contain errors.
danielmeppiel commentedon Nov 12, 2026
Decision: approve
Area: project
Scope: Extend the #3457 repair so packages with in-repo symlinks materialize identically on every host without requiring OS symlink capability: resolve each tracked symlink whose target stays inside the package from the locked commit's Git objects (link target read from the commit tree, resolved inside that tree, contained and cycle-bounded) and write the target's bytes and mode; reject escaping, broken or cyclic links with the existing diagnostic; keep the core.symlinks=true pin and its diagnostic only where still needed.
Done when: On Windows without symlink privilege, Linux and macOS, a fixture package with contained file and directory links yields byte-identical materialized trees and the same content_hash as today's POSIX result; apm install --frozen with a lockfile from another platform succeeds on a non-admin Windows host; escaping, broken and cyclic links fail before hashing with a clear diagnostic; packages without links are unaffected; docs state that contained links are copied as their content; the new tests fail on main.
Out of scope: Following symlinks for source discovery in authoring layouts (#2913, #2802); archive or proxy symlink extraction (#3110); changes to user or system Git configuration; content_hash algorithm changes; links that escape the package; line-ending determinism (#3270, #3368).
Review contact: Daniel Meppiel (@danielmeppiel)
danielmeppiel commentedon Nov 12, 2026
The
apm-scope:v1record above was approved by Daniel Meppiel (@danielmeppiel) on 2026-11-12. It extends the earlier record on this issue: contained symlinks are package content on every platform (same bytes andcontent_hasheverywhere), and resolving them from Git objects removes the Windows Developer Mode requirement introduced by #3545. Links that escape the package stay rejected.Posted with AI assistance on behalf of Daniel Meppiel (@danielmeppiel).
danielmeppiel commentedon Nov 12, 2026
Reopening: #3545 landed the first slice (pinned core.symlinks=true, contained symlinks are content). The extended scope recorded on 2026-11-12 for Git-object link resolution remains open.
fix(git): pin core.symlinks=true so package hashes match across platf…
fix(git): materialize package links from Git objects on every host (m…
fix(git): check out out-of-cone link targets with Git's own checkout (#…
fix(tests): restore release-gate lanes for 0.36.0 (#3723)