mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #236] [MERGED] feat(template): isolate template-build compression with [template_build] switch #277
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#277
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/236
Author: @huajq
Created: 9/1/2026
Status: ✅ Merged
Merged: 9/2/2026
Merged by: @yingdi-shan
Base:
main← Head:feat/template-build-compression📝 Commits (1)
fafa8dafeat(template): isolate template-build compression with [template_build] switch📊 Changes
13 files changed (+380 additions, -27 deletions)
View changed files
📝
CLAUDE.md(+1 -1)📝
config/default.toml(+13 -0)📝
docs/src/configuration/reference.md(+14 -0)📝
src/cfg.rs(+19 -2)📝
src/image/local_layer.rs(+32 -1)📝
src/sandbox/firecracker/overlaybd_snapshot.rs(+125 -3)📝
src/sandbox/firecracker/sandbox.rs(+24 -3)📝
src/sandbox/mod.rs(+1 -0)📝
src/sandbox/ublk/overlaybd.rs(+69 -11)📝
src/template/builder.rs(+31 -1)📝
src/template/runner.rs(+9 -2)📝
tests/integration/fc.rs(+3 -3)📝
tests/integration/snapshot.rs(+39 -0)📄 Description
What
Adds a dedicated
[template_build]compression section (compression_enabled/compression_algorithm/compression_workers, all off by default). When enabled, template builds capture snapshots with both memory layers and the sealed rootfs read-write layer written as ZFile-compressed overlaybd layers. Pause/capture of ordinary running sandboxes is unchanged.Why
The only pre-existing compression switch,
[memory_snapshot].compression_enabled, covers memory layers only (rootfs seals always stay raw) and is shared by every capture path — so compressing template-built artifacts forced operators to also pay compression CPU on every production pause. Template-built snapshots are the distribution vehicle for sandbox images; compressing their memory and rootfs delta layers shrinks repository storage and cross-node transfer, and that choice should be decoupled from the runtime pause policy.Related issue
N/A — no tracking issue.
Scope and non-goals
Included: the
[template_build]config section; compression-override plumbing in the template-build capture path; ZFile recontainerization of the sealed rootfs layer; the delta-filename convention extension; unit and integration tests; documentation.Intentionally excluded: the orchestrator pause/capture path (memory layers still consult only
[memory_snapshot], rootfs seals stay raw); extra drives (stay raw); ublk-daemon and theRestackSnapshotRPC (the daemon still seals raw); publish/resume/P2P code (existing zfile compatibility is reused); no per-API compression knob.Design and behavior changes
TemplateBuildConfigregistered as the[template_build]section. The shared algorithm enum is renamed toOverlaybdCompressionAlgorithm(serde wire valueslz4/zstdunchanged).FirecrackerSandboxgainssnapshot_compression_override, set only by the template runner;snapshot_to_dirprefers the override for both the memory output and the rootfs seal output.snapshot.commitas before (the live runtime keeps referencing it); the main process then recontainerizes only the staged artifact intosnapshot.zfile.commitvia the existingcompact_layersmachinery. The over-budget compaction path also honors the requested seal output.local_layer.rslearns thesnapshot.zfile.commitdelta filename (shared by the posixfs/OSS/ACR publish paths).[memory_snapshot].compression_enabled. If that switch is on but[template_build]is off, template artifacts stay raw.Compatibility and operations
[template_build]section; every key has a default (off /lz4/ 1), existing configs load unchanged.snapshot.zfile.commitname; ZFile is the standard overlaybd layer format that resume paths already read natively. Managed-layer bytes of template-built snapshots may now be ZFile (already true for memory layers).Validation
make fmtmake clippymake test-unitmake -C services test(required whenservices/changes)maketargetCommands and results:
Skipped checks and reasons: no benchmark — the non-template hot path is untouched (one extra
Optioncheck per capture); the compression cost (one extra read+write pass of the sealed layer) only applies to template-build captures with the switch on, by design.services/and generated code untouched, so those checks are N/A.Risks and reviewer notes
[memory_snapshot].compression_enabled; deployments relying on the old coupling must set[template_build]explicitly.src/sandbox/firecracker/overlaybd_snapshot.rs(staging recontainerization),src/sandbox/firecracker/sandbox.rs(override precedence),src/image/local_layer.rs(filename convention).Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.