Repository navigation
fix: reject explicit volume mounts on snapshots with volumes - #405
Merged
yingdi-shan merged 1 commit intoOct 22, 2026
Merged
yingdi-shan merged 1 commit into
yingdi-shan merged 1 commit into
Conversation
This was referenced Oct 21, 2026
There was a problem hiding this comment.
🟢 Approval recommended
The narrowly scoped validation preserves implicit restoration, has regression coverage, and leaves no unresolved findings.
No open issues 🎉
What changed in this PR
Prevents unsafe volume replacement when launching AgentENV templates or snapshots with captured volumes.
Changes:
- Rejects explicit
volumeMounts, including[], before volume allocation while preserving restoration when omitted. - Adds unit and end-to-end regression coverage.
- Updates API descriptions, CLI documentation, and contributor guidance.
| File | Description |
|---|---|
src/api/openapi.yml |
Documents rejection behavior for both creation endpoints. |
src/api/impls/sandbox.rs |
Adds shared validation and unit coverage. |
src/api/generated/src/models.rs |
Updates generated field documentation. |
scripts/tests/e2e/suites/15_volume.sh |
Tests explicit and empty mounts on both endpoints. |
docs/src/concepts/volumes/sandbox-forks-and-snapshots.md |
Explains captured-volume launch restrictions. |
docs/src/concepts/sandboxes/starting.md |
Documents the CLI volume restriction. |
CLAUDE.md |
Aligns contributor guidance with the new behavior. |
Review effort: Balanced
Contributor
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 3 selected item(s). |
Primary33
force-pushed
the
fix/reject-snapshot-volume-replacement
branch
from
October 21, 2026 09:49
16cdf5b to
7e8eb75
Compare
yingdi-shan
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Reject explicit
volumeMounts, including[], when launching a sandbox snapshot that contains volumes.Why
The restored guest retains its captured filesystems. Rebinding those drive slots to different volumes can corrupt data. Following the maintainer discussion, reject replacement instead of implementing the staging and unmount machinery in #404.
Related issue
Supersedes #404. Prerequisite for #398.
Scope and non-goals
Warm-start validation, API descriptions, CLI documentation, and regression coverage.
Design and behavior changes
Check the original optional field before allocating or reserving volumes. Omitting it restores the captured snapshot volumes. Templates still accept explicit mounts, as do snapshots without volumes. Both creation endpoints share this check.
Compatibility and operations
[].Validation
Tested on Ubuntu 24.04 as a non-root user with isolated state, dependencies, ports, and network ranges.
make agentenv-serverwith OpenAPI Generator 7.22.0make fmtmake clippycargo test -p agentenv --lib snapshot_volume_replacementmake test-unit— 1206 passed, plus shell checks; CLI tests serialized15_volume.sh— 56 assertions, including both endpoints and empty arrays16_volume_randomized.sh— 1696 assertions; Compose, seed 21106, 50 stepsRisks and reviewer notes
Empty arrays intentionally count as explicit replacement requests.
Checklist