Skip to content

[BUG] Re-downloaded marketplace-plugin trees stay unstamped, so lockfile hashes fail on fresh installs #3585

Closed

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

  1. Have a project with an apm.lock.yaml whose content hash for a marketplace-plugin dependency is stale (for example from an older APM version; the author reproduced this with anthropics/skills).
  2. 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.
  3. 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):

Logs
See the reproduction notes in #2627.

Additional context

Filed by issue-reduction-lane-h. This issue is AI-generated and may contain errors.

Activity

  1. danielmeppiel commented on Nov 12, 2026

    @danielmeppiel
    CollaboratorAuthor

    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)

  2. danielmeppiel commented on Nov 12, 2026

    @danielmeppiel
    CollaboratorAuthor

    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.

  3. added
    type/bug
    status/accepted
    on Nov 12, 2026
  4. added
    pillar/govern
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pillar/governstatus/acceptedtype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions