mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[GH-ISSUE #16] Prevent snapshot deletion from removing shared OCI manifests #12
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#12
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @huajq on GitHub (Jul 27, 2026).
Original GitHub issue: https://github.com/kvcache-ai/AgentENV/issues/16
Originally assigned to: @huajq on GitHub.
Summary
Snapshot image publications can produce identical OCI manifest digests when two publications reference the same OverlayBD layer set.
AgentENV currently records the manifest digest for each publication and deletes the manifest by digest when rolling back or deleting a snapshot. In OCI registries, multiple tags may point to the same content-addressed manifest. Deleting that manifest by digest can therefore invalidate every tag that references it, including tags owned by other snapshots.
Affected code
src/snapshot/repository/backends/common/acr/manifest.rssrc/snapshot/repository/backends/common/acr/publisher.rssrc/snapshot/repository/backends/oss/repository.rsCurrent behavior
The generated OCI manifest contains:
It does not contain the snapshot ID, publication tag, or disk subject.
Therefore, two publications with the same layer descriptors generate identical manifest bytes and the same manifest digest.
For example:
When snapshot
S1is deleted, AgentENV executes:Because
sha256:Mis shared, the registry may remove the manifest referenced by both tags.agentenv-snapshot-S2then becomes unavailable even though snapshotS2still exists.This is especially easy to trigger when publishing snapshots whose rootfs consists entirely of remote layers, but it can occur for any two publications that produce the same config and layer descriptors.
Expected behavior
Each snapshot rootfs or attached-drive publication should own a distinct manifest digest, even when its config and OverlayBD layer descriptors are identical to another publication.
Deleting or rolling back one snapshot publication must not invalidate another snapshot's image tag.
Layer and config blobs should remain content-addressed and shared; only the small manifest object needs to be publication-specific.
Proposed fix
Add the exact publication tag to the top-level OCI manifest annotations:
Attached-drive manifests should use their complete generated tag:
Including the publication tag makes the manifest bytes and digest unique per publication while preserving deduplication of:
No layer data needs to be duplicated or re-uploaded.
Cleanup reliability
Snapshot deletion should remove external registry publications before deleting the durable snapshot catalog record.
If registry cleanup fails, the catalog record and its persisted publication metadata must remain available so deletion can be retried. Invalid persisted publication metadata must return an error rather than being treated as successful cleanup.
Manifest deletion should remain idempotent: a registry
404 Not Foundis considered successful so partially completed multi-publication cleanup can be retried safely.