Repository navigation
Description
Related to #3372. Restoring a working tree from apm.lock.yaml on a machine with no ~/.apm receipts (a fresh clone, then apm install or apm install --frozen) is broken in 0.35.0 for packages whose lockfile entry has package_type: claude_skill or skill_bundle. The command skips their committed skill files, then removes them as stale, and exits 0. 0.34.0 does not do this.
Reproduction
mkdir demo && cd demo && git init
cat > apm.yml <<'EOF'
name: demo
version: 1.0.0
targets:
- claude
- copilot
dependencies:
apm:
- Aaronontheweb/dotnet-skills/skills/aot-trimming#v1.7.1
EOF
apm install # apm 0.35.0, Linux, no token
git add -A && git commit -m install
git clone . ../fresh && cd ../fresh
HOME=$(mktemp -d) apm install # empty HOME: no ~/.apm receipts
git status --short # 6 deleted files, apm.lock.yaml modified
HOME=$(mktemp -d) apm install --frozen gives the same result. With apm-cli==0.34.0 nothing changes.
Actual
Exit 0 and the six committed skill files are deleted (three under .agents/skills/aot-trimming/, three under .claude/skills/aot-trimming/). The output has Skipped .claude/skills/aot-trimming/SKILL.md: no trustworthy local deployment baseline. Preserve your changes before reinstalling with --force. followed by Cleaned 8 stale deployed files for aaronontheweb/dotnet-skills/skills/aot-trimming. apm.lock.yaml loses deployed_files and deployed_file_hashes for the package, and apm audit --ci then exits 1 with "Drift detected: 6 file(s)".
Expected
Files that are byte-identical to the package source (these are) should be left alone or adopted. Skipped files should stay on disk and stay in the lockfile. #3344 says "Missing receipts preserve existing files" and "Cleanup outcomes authorize retirement, not deletion".
Scope
- Affected:
claude_skill(aot-trimming above) andskill_bundle(obra/superpowers#v7.0.0deletes 34 files). A repo whose only dependency ismicrosoft/apm/packages/apm-guide(apm_package) is unaffected. - The result is the same when the install was written by 0.34.0 or by 0.35.0.
--forcerestores the files, but the working tree is unchanged afterwards, so the next cold install deletes them again.- In 0.35.0's
skill_integrator.py, the.apm/skillspath (_promote_sub_skills) computesunchanged = … is_skill_dir_identical_to_source(…), while the native-skill path (_integrate_native_skill) has no equivalent check. That looks like the cause, but I have not confirmed it.
Impact
Any workflow that restores state from the lockfile on a fresh machine: CI runners, cloud agents and Renovate. Renovate's apm manager bumps apm.yml, runs a plain apm install and commits every changed file, and it cannot pass --force. Emulating it on the repo above (committed at #v1.7.0, bump to #v1.7.1, cold apm install): 0.35.0 deletes the six files and the bump PR would commit the deletions; 0.34.0 deletes nothing.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
juancarlosjr97 commentedon Oct 26, 2026
Thank you for raising it. I thought this was a behaviour of Renovate, but I ended up narrowing it down to APM renovatebot/renovate#47386
fix(apm): restore dependency skills deleted by APM 0.35.0 (#76)
milkshakeuk commentedon Oct 27, 2026
Reproduced on 0.35.0 (17a2fc4), Linux (WSL2 Ubuntu 24.04), Homebrew, isolated
HOME, withdgalarza/agent-skills/skills/conventional-commits#2026.10.19(claude_skill). Three detailsthat may help narrow it down:
apm install, commit, delete only~/.apm/deployment-receipts/<sha256("<project root>|project")>.json(leaving.apm-local/in place), then run
apm installagain. You get the same result: exit 0,Cleaned 3 stale deployed files, the twono trustworthy local deployment baselinewarnings,both files deleted, and
deployments: []. A second plain install restores everything andwrites a fresh receipt.
files are byte-identical to
apm_modules/.../conventional-commits/*(cmppasses), yet theyare skipped.
_integrate_native_skillcalls_copy_skill_bundle(...)atskill_integrator.py:1263withoutunchanged=, so theunchanged and is_content_identical_to_source(...)shortcut inBaseIntegrator.copy_directory_files(base_integrator.py, around line 322) never runs. Withsession.baseline()returningNone, the member is skipped through the(baseline_hash is not None and expected is None)branch.files go unrecorded (per fix(skills): preserve shared assets and deployment ownership #3313, only files actually written are recorded). Post-install
stale cleanup then treats them as files "the current install no longer produces", in the words
of
integration/cleanup.py's module docstring, and deletes them, because the old lockfilehash still matches the disk. If the bytes don't match (a user edit), the provenance gate keeps
the file. In a mixed case that leaves a half-installed skill directory: the edited
SKILL.mdis kept, the untouched
references/commit-examples.mdis deleted, and the package's wholedeployed_filesblock is still dropped. The upgrade-with-missing-receipt case in [BUG] 0.35.0 regression: coldapm install --frozendeletes a committed skill that two dependency entries deliver, then exits 0 #3372(old bytes match the old lock hash, new source differs) would still delete files even with
adoption fixed. Skipped-for-missing-evidence members probably need to stay in the
current-install set, so cleanup can't retire them.
The existing regressions (
test_untrusted_receipt_does_not_replace_legacy_deployment[missing],test_recreated_checkout_with_retained_outputs_has_no_old_authority) use a branch-switch fixturewhere the on-disk bytes differ from the checked-out lock hash, so cleanup's provenance gate
protects the file. The unchanged-package case, where the disk matches the lock hash, isn't
covered, and that's the case that deletes.
m4olivei commentedon Oct 28, 2026
We hit this through Renovate's
apmmanager too, in a project that commits its deployed skills under.claude/skills/. Our first Renovate MR after moving to 0.35.0 bumped one dependency to a new minor version. It deleted that package's deployed skills, and also the skills of another dependency that wasn't part of the update at all.Results from fresh worktrees of the same commit with 0.35.0 (target
claudeonly), in case they help with scope:apm installdeletes the committed skill of aclaude_skilldependency.skill_bundle, resolved asmarketplace_pluginat the new version) has every deployed file deleted after a "no trustworthy local deployment baseline" warning for each one. Theclaude_skilldependency that wasn't updated loses its files in the same run.apm installrestores everything, and later runs are stable..apm-local/brings it back: with~/.apm/deployment-receipts/left in place, the next install deletes again. So either half of the receipt state being missing is enough, which complements the receipt-only repro above.We've pinned 0.34.0 and set Renovate's
allowedVersions: "!/^0\\.35\\.0$/"forapm-cliuntil a fix ships.Likely duplicate: #3372 seems to have the same root cause. Its title covers the narrow case (
--frozen, a skill delivered twice), but its comments report the same missing-receipt deletion on plain installs and upgrades without duplicate delivery. It might be worth tracking both in one place, so the fix covers every trigger and reports don't split across two threads.danielmeppiel commentedon Nov 10, 2026
Decision: approve
Area: project
Scope: When deployment receipts are missing on a cold restore, adopt existing native-skill and skill_bundle files that are byte-identical to the materialized package source, matching the existing .apm sub-skill adoption (is_skill_dir_identical_to_source), so restoring unchanged committed skills on a fresh checkout succeeds as it did in 0.34.0, while any file that differs keeps the #3372 fail-closed path (no overwrite, no deletion, nonzero exit).
Done when: Installed-CLI or integration tests with claude_skill and skill_bundle fixtures show that a fresh clone with committed, unchanged skills and no receipts completes apm install and apm install --frozen with exit 0, records receipts and leaves bytes intact; a locally edited file is neither overwritten nor deleted and the command exits nonzero with guidance; .apm sub-skill adoption is unchanged; lockfile hashes are not used as adoption evidence; the byte-identical case fails on current main.
Out of scope: Trusting lockfile deployed_file_hashes as a baseline; receipt root identity (#3421); the #3372 deletion fix itself (PR #3490); other primitive types; --force semantics.
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).
Linked pull requests:
apm install --frozendeletes a committed skill that two dependency entries deliver, then exits 0 #3372 deletion fix; this scope is the follow-up for adopting unchanged committed skills.Generated by autopilot-issue-triage-worker. This comment is AI-generated and may contain errors.
Work around APM 0.35.0 deleting committed deployed files
fix(install): adopt unchanged committed skills on cold restore (micro…
Work around APM 0.35.0 deleting committed deployed files
Name edited deployed files before apm install refuses them
milkshakeuk commentedon Nov 12, 2026
I re-tested on 0.35.1 (787a97c). After #3490 a cold clone no longer loses its committed files, but
apm install --frozenstill can't restore a committed subpath package or one with an edited file. Repro, with a freshHOMEper run so there are no receipts:[x] 1 package failed:with 21 lines ofSkipped .claude/skills/codebase-readiness/<file>: no trustworthy local deployment baseline. Move the conflicting file aside and retry; use --force only to intentionally overwrite it., then[x] Installation failed with 21 error(s) ... No install transaction changes were committed.The tree is unchanged. On 0.35.0 the same run exited 0 and deleted all 21 files.microsoft/playwright-cli#v0.1.23) with one hand-edited file: exit 1, with all 11 of its files refused, not just the edited one. The tree is unchanged. On 0.35.0 it exited 0 and deleted the other 10.Every refused file except the one edit is byte-identical to the lockfile's
deployed_file_hashes, so adopting matching committed files on cold restore (#3564) would make the first case pass and limit the second to the edited file. Until then, tools that run on fresh checkouts have to delete matching files beforeapm installto work around it, which is what dependabot/dependabot-core#16792 does. The scripts are in this gist.fix(ci): write LF bytes in rendered-markdown adoption test on Windows (…
fix(update): adopt unchanged locked skills when receipts are missing (#…
Work around APM 0.35.0 deleting committed deployed files
Name edited deployed files before apm install refuses them
Work around APM 0.35.0 deleting committed deployed files
Name edited deployed files before apm install refuses them
Name edited deployed files before apm install refuses them