Repository navigation
Description
Describe the bug
After a reboot, apm install -g and apm update -g fail on a host whose home directory is a btrfs subvolume:
Error updating dependencies: Failed to resolve APM dependencies: Invalid local
materialization evidence at ~/.apm/deployment-receipts/<key>.json: installation
binding does not match. Preserve local skill edits, then remove the invalid
receipt file and retry. Existing files without trustworthy evidence will not be
overwritten.
Nothing about the installation changed. DeploymentLedger._load (src/apm_cli/core/deployment_ledger.py) compares the stored root_identity with [st_dev, st_ino] of the deployment root. btrfs gives each subvolume an anonymous device number when it is mounted, so st_dev of a directory on a subvolume is not stable across boots. On my host:
| receipt (written 2026-10-27) | after reboot (2026-10-30) | |
|---|---|---|
st_dev of ~ |
56 | 30 |
st_ino of ~ |
257 | 257 |
~/.apm-local/installation |
f82796f2… |
f82796f2… (unchanged) |
| root, scope, version | match | match |
~ is on /dev/mapper/root[/@home] (subvol=/@home), the default layout on Arch-based distributions and on Fedora and openSUSE. All 357 recorded destinations still matched their recorded content_hash.
I understand the binding comes from #3339 / #3344: a checkout recreated at the same pathname, possibly with .apm-local/installation copied into it, must not reuse a prior installation's receipt (test_recreated_checkout_cannot_reuse_old_receipt). [st_dev, st_ino] is the right POSIX identity for that, but on btrfs (and possibly other filesystems with dynamic device numbers) the device half changes for the same directory, so a healthy root is treated as recreated. User scope is hit hardest, since ~ is never a recreated checkout, but the same applies to project roots on a subvolume.
To Reproduce
- On a host whose home directory is a btrfs subvolume, run
apm install -gwith any dependency that deploys a skill, so~/.apm/deployment-receipts/is written. - Reboot. Compare
stat -c %d ~with theroot_identitystored in the receipt; the first number differs. - Run
apm update -gorapm install -g; it fails with the error above.
Without a reboot, setting the first number of root_identity in the receipt to any other value reproduces the same failure deterministically.
Expected behavior
The same directory keeps its binding across reboots and remounts, while a recreated root is still rejected. Some options that keep the #3339 intent, for maintainers to choose from:
- Bind to a mount-stable identity instead of
st_dev, for example the filesystem identity fromstatvfs().f_fsid(on btrfs derived from the filesystem and subvolume, so I'd expect it to survive remounts, though I have not verified that across a reboot). - Detect recreation with inode plus creation time (
statxbtime), which does not involve device numbers. - Accept a binding whose inode and installation UUID match when only
st_devdiffers.
Environment (please complete the following information):
- OS: Linux 7.2 (Arch-based), home on btrfs subvolume
@home - Python Version: 3.13.16
- APM Version: v0.35.0, via a fork build (
0.35.0+omni.6). The fork's only change todeployment_ledger.pyadds two target path prefixes;_root_identityand_loadare identical to v0.35.0 and to currentmain.
Logs
See the error above. The only differing field is root_identity[0].
Additional context
The suggested recovery, deleting the receipt, discards the baseline for all 357 files, after which none of them can be updated in place. I restored the binding instead by setting root_identity[0] to the current st_dev after checking every recorded hash against disk, and the update then proceeded.
I'm happy to help with a fix once the scope is decided.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
Keep deployment receipts valid across remounts of their root
build(agents): pin apm 0.35.0+omni.7
feat(agents)!: read apm outdated as JSON, pin apm 0.35.0+omni.7
chore(renovate): extend the shared presets and automerge majors (#113)
maro114510 commentedon Nov 4, 2026
Same thing on macOS. My home dir's st_dev changed from 16777234 to 16777229 and the receipt stopped matching.
--force doesn't get past it. You have to delete the receipt, and then running without --force wipes skill files.
#3439 doesn't fix a receipt that's already drifted, I tried it.
danielmeppiel commentedon Nov 10, 2026
Decision: approve
Area: project
Scope: Keep deployment-receipt root binding stable across reboots and remounts on Linux and macOS by accepting and rebinding a receipt when only the root's st_dev differs while inode, installation UUID, resolved root path and (where the platform provides it) birth time all match, while a recreated root or a copied .apm-local is still rejected, preserving the #3339/#3344 receipt safety boundary.
Done when: Unit tests simulating a changed st_dev with matching inode, installation UUID, path and birth time show apm install -g and project install succeed and the receipt is rebound; a changed inode, UUID, path or birth time is still rejected with the existing error; a copied .apm-local in a recreated checkout is rejected; tests cover Linux-style and macOS-style stat results; the tests fail on current main.
Out of scope: A new receipt namespace or format version; Windows identity changes; volume-UUID or statvfs-based identity; receipt migration beyond rebinding; recovery when receipts are missing (#3372, #3391).
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:
Generated by autopilot-issue-triage-worker. This comment is AI-generated and may contain errors.
fix(receipts): rebind receipts when only the root st_dev changes
test(receipts): prove the installed CLI rebinds a drifted st_dev
fix(receipts): preserve macOS identity across remounts with downgrade…
danielmeppiel commentedon Nov 10, 2026
Delivered by #3439, merged as 59549ac. On Linux and macOS, a deployment receipt is now rebound when only the root's st_dev changes and inode, installation UUID, resolved path and birth time (where recorded) all match. A recreated root or a copied
.apm-localis still rejected. This meets the Done-when of the approved scope record, so I am closing this as completed. Missing-receipt recovery (#3372, #3391) was out of scope and is tracked separately.Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.