Repository navigation
Closed
Labels
status/acceptedHuman scope approval; verify the issue's approval record and review contact before work.type/bugSomething does not work as documented.
Milestone
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.
Describe the bug
A local bundle and a path dependency deploy the same instruction file. After apm uninstall of the path dependency:
- The instruction file is deleted from disk, even though the lockfile still records it as deployed and owned by the local bundle (
active_owner: local-bundle). The lock now records a deployed file that does not exist (I1). - The command prints
[x] 1 package failed: Materialization copilot||project|.github/instructions/f-doc.instructions.md has no ownership metadata, then[*] Uninstall complete, and exits 0. An error line with a success exit breaks the exit contract (I8).
To Reproduce
- Create a package
f-docwithapm.yml(name: f-doc,version: 1.0.0,dependencies: {apm: []}) and.apm/instructions/f-doc.instructions.md(frontmatterapplyTo: '**'). - Pack it:
apm pack --archive -o outgivesout/f-doc-1.0.0.zip. - Add a skill to the same package source (
.apm/skills/f-doc/SKILL.md). - In a consumer project with
targets: [copilot]anddependencies: {apm: []}:apm install out/f-doc-1.0.0.zipdeploys.github/instructions/f-doc.instructions.md(local bundle).apm install <path to f-doc>deploys the skill and the same instruction path.apm uninstall <path to f-doc>exits 0. Its output:[+] Cleaned up 1 integrated instruction [x] 1 package failed: +- Materialization copilot||project|.github/instructions/f-doc.instructions.md has no ownership metadata [*] Uninstall complete: removed 1 package
.github/instructions/is now empty, butapm.lock.yamlstill lists.github/instructions/f-doc.instructions.mdunderlocal_deployed_filesand as a deployment withactive_owner: local-bundle.
Expected behavior
uninstallkeeps a file that another owner (here the local bundle) still holds, and the lock stays equal to disk.- If uninstall cannot complete a package, it exits non-zero and leaves state consistent, as it already does when the bundle also ships the skill: "Uninstall could not remove tracked target files ... Resolve or remove the listed files, then retry uninstall", exit 1.
Environment (please complete the following information):
- OS: macOS
- Python Version: 3.12
- APM Version: 0.37.0 (main 488a4b1)
Logs
See the output in step 4.
Additional context
- Epic [EPIC] Promise-driven lifecycle test corpus: 0.38 completion #4565. Found by the T-6c file-routing scenario lane (FILEROUTE=deployed, Lifecycle test family: platform scenario suite #4102). Cell:
pair|OP=uninstall|FILEROUTE=deployed, in the variant where a local bundle shares the path. - The fix PR must flip strict cell
uninstall-keeps-a-bundle-owned-instructionintests/lifecycle/scenarios/test_file_routing.pyto required in the same PR (a strict XPASS fails CI).
Metadata
Metadata
Assignees
Labels
status/acceptedHuman scope approval; verify the issue's approval record and review contact before work.type/bugSomething does not work as documented.
Type
Projects
- StatusShow more project fieldsDone
Activity
danielmeppiel commentedon Nov 21, 2026
Decision: approve
Area: project
Scope: apm uninstall keeps a deployed file that another owner, such as a local bundle, still holds, so the lockfile stays equal to disk (lifecycle law I1). When uninstall cannot complete a package it exits non-zero and leaves state consistent, the same way it already refuses when the bundle also ships the skill, instead of printing a package failure and exiting 0 (lifecycle law I8). Uninstall never deletes more than before.
Done when: The T-6c file-routing cell pair|OP=uninstall|FILEROUTE=deployed (strict cell uninstall-keeps-a-bundle-owned-instruction) is flipped to required in the same PR and passes: the shared instruction stays on disk, the lockfile matches disk, and any reported package failure exits non-zero. It fails before the fix and passes after it, a bug-ledger row and a CHANGELOG line are added, and CI is green.
Out of scope: Changes to ownership precedence between owners; uninstall of files no other owner holds; lockfile format.
Review contact: Daniel Meppiel (@danielmeppiel)
test(lifecycle): train 4 -- observable outcomes for T-6c/T-7b scenari…
test(lifecycle): witness the 28 FILEROUTE scenario cells (T-6c)
test(lifecycle): flip uninstall-keeps-a-bundle-owned-instruction to r…
fix(uninstall): drop a row no owner still holds instead of failing (#…
fix(uninstall): a shrink-retired path a local bundle holds is never a…
fix(uninstall): count critical-security survivor blocks and consume s…
fix: keep engine.py under the line limit; pass runtime in the generic…
fix(uninstall): consume superseding proofs only for a departing-only …
fix(uninstall): count failed packages as the summary does; ownerless …
test: move the #4703 departing-owner reconciler tests to a unit module
3 remaining items
test(quality): refresh known-cell snapshot after the #4703 cell resolves
docs(apm-guide): one uninstall and prune row; fold #4703 wording into…
Merge origin/main into danielmeppiel-4703-uninstall-bundle-owned
Merge origin/main into danielmeppiel-4703-uninstall-bundle-owned
Merge origin/main (#4650) into danielmeppiel-4703-uninstall-bundle-owned
Merge origin/main into danielmeppiel-4703-uninstall-bundle-owned
Merge pull request #4715 from microsoft/danielmeppiel-4703-uninstall-…
fix(lint): re-key the hook settings cleanup write exemption to write_…
test(uninstall): drive the #4703 cleanup cell through the candidate o…