mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #398] [MERGED] feat: attach image drives to warm starts #405
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#405
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/398
Author: @Primary33
Created: 10/20/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @yingdi-shan
Base:
main← Head:feat/image-mounts📝 Commits (1)
136e662feat: attach image drives to warm starts📊 Changes
19 files changed (+1186 additions, -273 deletions)
View changed files
📝
crates/aenv/src/client/sandboxes.rs(+57 -9)📝
crates/aenv/src/commands/start.rs(+168 -3)📝
docs/src/concepts/sandboxes/starting.md(+37 -0)📝
docs/src/getting-started/aenv-cli/sandboxes.md(+2 -0)📝
src/api/generated/src/models.rs(+17 -0)📝
src/api/impls/sandbox.rs(+331 -175)📝
src/api/openapi.yml(+9 -0)📝
src/sandbox/extra_drive.rs(+4 -2)📝
src/sandbox/firecracker/config.rs(+38 -10)📝
src/sandbox/firecracker/sandbox.rs(+227 -38)📝
src/sandbox/mod.rs(+1 -1)📝
src/snapshot/backends/tests.rs(+2 -2)📝
src/snapshot/store/posix_tests.rs(+1 -1)📝
src/snapshot/types/drive.rs(+1 -1)📝
src/snapshot/types/manifest.rs(+37 -8)📝
src/snapshot/types/snapshot.rs(+11 -0)📝
src/types/extra_drive.rs(+111 -12)📝
src/types/mod.rs(+1 -1)📝
tests/integration/snapshot_attached_drive.rs(+131 -10)📄 Description
What
Add
attachedDrivestoPOST /v2/sandboxes, so warm starts can attach image drives the same way cold starts do.aenv start --image-mount PATH=IMAGE(writable) and--image-mount-ro PATH=IMAGEbuildattachedDrivesentries for both warm and cold starts; CLI warm starts now use v2.Why
Mount models, datasets, or code from an image without managing persistent volumes or building a template for each combination.
Related issue
Requested in a maintainer discussion. Builds on merged #405. Replaces the earlier
imageMountsdesign in this PR, following the review.Scope and non-goals
AttachedDriveschema, defaults, andresolve_attached_drives; the cold-start path is unchanged.imageMountsAPI, no catalog records, and no sweep task.ro,noloadafter boot instead of by init.Design and behavior changes
ExtraDrive.volume: boolbecomesExtraDriveKind { Physical, LaunchSlot, Volume }. Drives added at a snapshot launch areLaunchSlotand take reserved Firecracker slots ahead of volumes.LaunchSlotdrives are committed to the manifest like physical drives but keep their slots, because the VM state records them under the slot device IDs.physical_extra_drive_countnow counts only drives with their own device IDs; the attached drives after them occupy the first slots, and launch-time drives use the slots that follow.diskSizeMBis the target size).attachedDrives, including[].volumeMountskeeps the #405 rule. Attached drives plus explicit volumes must fit in the snapshot's free slots, and attached drive paths must not overlap volume mount paths (HTTP 400).Compatibility and operations
attachedDrivesonNewSandboxV2; regenerated models.readOnlystill defaults totruein the API;--image-mountsendsfalse.physical_extra_drive_countmay now be smaller than the number of attached drives. PersistedExtraDrivekeeps the booleanvolumefield for physical drives and volumes;LaunchSlotis written as"launch_slot".LaunchSlotdrives; upgrade servers and the CLI together.Validation
Validated on Ubuntu 24.04 as a non-root user with isolated state and dependencies.
make fmtmake clippymake test-unitmake -C services test(required whenservices/changes)maketargetCommands and results:
New integration test
launch_time_attached_drive_keeps_its_slot_across_capturescovers launch-time attach, capture, relaunch, fork, and a second capture.Skipped checks and reasons:
make -C services test:services/is unchanged.16_volume_randomized.sh: needs a multi-node Compose deployment.posix_startup_pack_publish_resolve_and_resume: ignored by default; needs startup-pack configuration.Risks and reviewer notes
Slot bookkeeping is the main risk: see
FirecrackerSandbox::snapshot_config_for_launch,prepare_resume_drives, and the manifest count inpause_to_dir(src/sandbox/firecracker/sandbox.rs), plusSandboxSnapshotManifest::extra_drivesandfree_drive_slots. API validation is increate_sandbox_from_snapshot(src/api/impls/sandbox.rs); the v1sandboxes_postbody moved there unchanged apart from the new checks. Warm-start attached drives are not added to MMDSimageConfigs.Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.