mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #220] [MERGED] fix(snapshot): increase overlaybd compaction threshold with dynamic calculated value #262
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#262
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/220
Author: @huajq
Created: 8/26/2026
Status: ✅ Merged
Merged: 8/27/2026
Merged by: @yingdi-shan
Base:
main← Head:fix/runtime-owned-layer-compaction📝 Commits (1)
d0a84d8fix(snapshot): increase overlaybd compaction threshold with dynamic calculated value📊 Changes
1 file changed (+140 additions, -7 deletions)
View changed files
📝
src/sandbox/firecracker/overlaybd_snapshot.rs(+140 -7)📄 Description
What
Change the overlaybd snapshot layer compaction trigger in
rewrite_lowers_with_runtime_rootsfrom "total lowers > 32" to a dynamic budget on the runtime-owned suffix only:max(32 - stable_prefix/4, 1). Adds regression tests for both sides of the trigger.Why
The old trigger counted the stable base prefix. On a deep base (e.g. a 32-layer rootfs), every pause compacted the entire runtime-owned suffix into a new cumulative file: the layer count pinned at 33 while each compaction rewrote (and on publish re-uploaded) all deltas since the base. Two snapshots branching from the same parent each re-upload their shared ancestry.
Related issue
N/A
Scope and non-goals
Included: trigger semantics + unit tests. Excluded (known follow-ups, unchanged by this PR): distributed snapshot chains resumed from the repository still grow one layer per generation (a single-layer suffix is never compacted); no managed-layer GC; no streaming compaction of remote (OSS/registry) lowers.
Design and behavior changes
Compaction now fires only when the runtime-owned suffix plus the appended layer exceeds a budget that shrinks as the stable prefix grows (32 with an empty prefix, 24 with a 32-layer prefix, clamped to 1). Stable base lowers never trigger compaction on their own; total stack depth stays well below overlaybd's 255-layer hard limit. What gets compacted is unchanged: the runtime-owned suffix only, never remote lowers.
Compatibility and operations
Validation
make fmtmake clippymake test-unitmake -C services test(required whenservices/changes)maketargetCommands and results:
Skipped checks and reasons: integration tests not run (Linux sandbox run; the trigger logic is covered by the added unit tests). The one full-suite failure is
privileges::tests::scoped_spawn_clears_child_capabilities_without_mutating_caller, a pre-existing capability assertion that fails when tests run as root; it is unrelated to this change.Risks and reviewer notes
Single file:
src/sandbox/firecracker/overlaybd_snapshot.rs. Main risk is behavioral: deep-base snapshots now reach higher layer counts (up to base + budget) before compacting — bounded well under the 255 hard limit by the shrinking budget.Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.