Repository navigation
Description
Reporting and investigating a bug need no permission. Before implementing a
substantive fix for inclusion in APM, obtain human scope approval and a review
contact on this issue. Trivial documentation corrections have standing
preapproval. See Contributing.
For vulnerabilities, use SECURITY.md
instead of a public issue. Remove credentials and other sensitive data from logs.
Describe the bug
When a marketplace-plugin package (a Claude plugin without its own apm.yml) is re-downloaded within the same process, the re-materialized tree is left unstamped, so its content hash matches no lockfile entry.
During materialization APM rewrites the package apm.yml twice: synthesis writes version: 0.0.0, then stamp_plugin_version (src/apm_cli/deps/package_validator.py) replaces it with the short commit SHA. APMPackage.from_apm_yml (src/apm_cli/models/apm_package.py) memoizes parsed manifests per path for the whole process, and only the coarse clear_apm_yml_cache() exists; no rewrite site invalidates its own path. On a same-process re-download (for example when integrate's content-hash pre-check removes and re-acquires the tree), re-synthesis writes a fresh 0.0.0 manifest, but from_apm_yml returns the stale, already-stamped instance. stamp_plugin_version then skips because its guard requires version == "0.0.0", and the on-disk tree stays at 0.0.0.
Reported and diagnosed by McNultyyy in #2627, which also contains a candidate fix.
To Reproduce
- Have a project with an
apm.lock.yamlwhose content hash for a marketplace-plugin dependency is stale (for example from an older APM version; the author reproduced this withanthropics/skills). - Run
apm install --update: the package is re-acquired in the same process, the tree is left unstamped, and the lockfile records the unstamped-tree hash. - Run a fresh install (for example in a clean clone or CI). The supply-chain integrity check fails because the recorded hash matches neither the stamped nor any other expected tree.
Expected behavior
Every materialization of a marketplace-plugin tree, including a re-download within one process, is stamped consistently, so the hash recorded in apm.lock.yaml matches the materialized content and later fresh installs pass the integrity check.
Environment (please complete the following information):
- OS: any (reported while verifying fix(deps): write synthetic package manifests with LF so content hashes match across OSes (closes #2619) #2620)
- Python Version: n/a
- APM Version: current main (code paths verified on main 2ffc07c)
- VSCode Version (if relevant): n/a
Logs
See the reproduction notes in #2627.
Additional context
- Candidate implementation: fix(deps): invalidate the manifest parse cache when apm.yml is rewritten, so re-downloads re-stamp #2627 (per-path cache invalidation at every
apm.ymlrewrite site, with a lock and a generation counter for parallel resolver threads, plus a stress test). - Related: [BUG] Subdirectory/skill-subset package content hashes differ across OSes due to synthetic apm.yml line endings #2619 and fix(deps): write synthetic package manifests with LF so content hashes match across OSes (closes #2619) #2620 (cross-OS content-hash fixes), feat(install): auto-migrate legacy CRLF-domain lockfiles and warm trees (apm#2619) #2628 (declined lockfile auto-migration, independent of this repair).
Filed by issue-reduction-lane-h. This issue is AI-generated and may contain errors.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
danielmeppiel commentedon Nov 12, 2026
Decision: approve
Area: project
Scope: Stamp re-downloaded marketplace-plugin trees so the content hash recorded in apm.lock.yaml matches the materialized content, including when a package is re-acquired within the same process (for example by apm install --update).
Done when: A same-process re-download of a marketplace-plugin package leaves its apm.yml stamped with the short commit SHA; the hash recorded in apm.lock.yaml matches the materialized tree; a later fresh install from that lockfile passes the integrity check; a regression test reproduces the unstamped re-download and passes with the fix.
Out of scope: Automatic migration of existing lockfiles with stale hashes; changes to the content-hash algorithm or lockfile schema; changes to version stamping for non-marketplace package types.
Review contact: Daniel Meppiel (@danielmeppiel)
danielmeppiel commentedon Nov 12, 2026
The scope record above was approved by Daniel Meppiel (@danielmeppiel) on 2026-11-12. This defect is accepted and bounded to consistent stamping of re-downloaded marketplace-plugin trees so lockfile hashes match what is materialized. Thank you McNultyyy for diagnosing it: #2627 is the candidate implementation and can be reviewed against this record. Items listed as out of scope need a separate discussion.
Generated by issue-reduction-lane-h. This comment is AI-generated and may contain errors.
fix(deps): invalidate manifest cache after catalog-only apm.yml replace
test(deps): lock re-download hash to the recorded and fresh hashes
fix(deps): invalidate the manifest parse cache when apm.yml is rewrit…