mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #249] [MERGED] fix: reuse published layers when cloning volumes #288
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#288
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?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/AgentENV/pull/249
Author: @yingdi-shan
Created: 9/6/2026
Status: ✅ Merged
Merged: 9/8/2026
Merged by: @yingdi-shan
Base:
main← Head:fix/volume-layer-reuse📝 Commits (1)
946e0c4fix: reuse published layers when cloning volumes📊 Changes
1 file changed (+312 additions, -19 deletions)
View changed files
📝
src/volume.rs(+312 -19)📄 Description
What
Reuse committed repository layer references when cloning an unreserved, published volume. Cloning now creates a volume record and materializes its image config on mount, preserving each inherited layer's digest and size. Reserved source volumes continue cloning their local files so unpublished writes are retained.
Why
A template build investigated in #247 spent 33.556 seconds deleting its builder and another 33.375 seconds publishing the next cache seed. Both operations hashed the same inherited 7.43 GB BuildKit cache layer. The local cache config lacked descriptors even though its volume record already contained the published layer references; reproducing the Rust hash loop against that layer took 33.98 seconds.
Reusing published references eliminates seed republication and supplies descriptor-bearing configs to subsequent writable clones, so unchanged inherited layers bypass full-file hashing during publication. Existing cache generations benefit without rewriting their old local configs.
Related issue
Diagnosed while testing #247. This PR is based directly on
mainand does not depend on or modify #247.Scope and non-goals
The change is confined to volume cloning and its regression tests. It applies to both POSIX and OSS repositories through the existing repository interfaces. New local data still follows normal publication and integrity checks.
Design and behavior changes
Compatibility and operations
Validation
make fmtmake clippy(workspace, all targets and features, warnings denied).make test-unit: 812 ordinary AgentENV tests, 4 capability tests, 3 Linux capability tests, 8 ublk tests, 46 daemon tests, and both shell verification scripts passed.cargo test -p agentenv --lib volume::tests: 5 passed.git merge-tree --write-tree HEAD fork/feat/template-buildkit: clean merge with #247 atc53bc78.Regression coverage includes stale and absent local configs, cold managers, managed and external layers, parent deletion, successive read-only/writable generations, unpublished writes from reserved sources, and source state/size validation.
Live BuildKit/VM integration and a post-fix wall-clock benchmark have not been run. BuildKit remains in the separate, unmerged #247. Services and generated code are untouched.
Risks and reviewer notes
The optimization requires an unreserved source because a reserved volume can contain local changes newer than its committed backing. Tests exercise that distinction. Content addressing and repository ownership remain authoritative for published layers.
Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.