Skip to content

fix: APM Materialize deletes the committed security-audit skill #237

Closed

Description

@DevSecNinja

Problem

APM Materialize opened #233, which deletes all 20 files of the committed external security-audit skill (.agents/skills/security-audit/) and drops its deployed_files from apm.lock.yaml, although apm.yml still pins cloudflare/security-audit-skill/skills/security-audit#c1c8a8c1.

Run 43461776196 (apm install --update --only apm, apm-cli 0.35.0) logs:

[i] Cleaned 21 stale deployed files for cloudflare/security-audit-skill/skills/security-audit
[!] Skipped .agents/skills/security-audit/AI-AND-LLM.md: no trustworthy local deployment baseline. ...

Root cause

It is not line endings or a Windows-generated lock. The committed files are LF and their SHA-256 hashes match apm.lock.yaml exactly.

APM 0.35.0 only trusts a skill file's overwrite baseline from per-user deployment receipts (~/.apm/deployment-receipts/ plus .apm-local/installation). It never trusts the committed lockfile (DeploymentMaterializationSession.baseline). A fresh CI checkout has no receipts. For a root-level skill package (claude_skill), _integrate_native_skill has no "unchanged, adopt it" shortcut, so every committed file is skipped as possibly user-edited. Nothing is deployed for the package, so the cleanup phase then deletes all 21 lock-tracked paths as stale.

Upstream tracks this as microsoft/apm#3372. v0.35.1 (microsoft/apm#3490) fails closed instead of deleting. Adoption of unchanged committed skills on cold restore and update (microsoft/apm#3564, microsoft/apm#3638) is only on main, not released yet.

Fix

  • Before apm install, APM Materialize removes the external skill folders recorded in apm.lock.yaml. APM then redeploys them from the pinned commit; a missing target needs no receipt. The committed copy stays the review baseline, so the materialize PR diff still shows upstream changes.
  • A guard (check) fails materialize, and PR CI, when a locked dependency deploys nothing, a deployed file is missing, or a committed .agents/skills/ file isn't claimed by the lock.
  • Close chore: materialize APM primitives #233 unmerged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions