[PR #405] [MERGED] fix: reject explicit volume mounts on snapshots with volumes #408

Closed
opened 2026-10-29 14:23:05 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/AgentENV/pull/405
Author: @Primary33
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @yingdi-shan

Base: main ← Head: fix/reject-snapshot-volume-replacement


📝 Commits (1)

  • 7e8eb75 fix: reject explicit volume mounts on snapshots with volumes

📊 Changes

7 files changed (+79 additions, -2 deletions)

View changed files

📝 CLAUDE.md (+2 -1)
📝 docs/src/concepts/sandboxes/starting.md (+1 -1)
📝 docs/src/concepts/volumes/sandbox-forks-and-snapshots.md (+5 -0)
📝 scripts/tests/e2e/suites/15_volume.sh (+23 -0)
📝 src/api/generated/src/models.rs (+2 -0)
📝 src/api/impls/sandbox.rs (+38 -0)
📝 src/api/openapi.yml (+8 -0)

📄 Description

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.

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

  • API: previously accepted replacement requests now return HTTP 400. E2B JS SDK 2.58.0 omits the field by default; explicit empty mounts serialize as [].
  • Configuration, snapshot format, and host requirements: unchanged.

Validation

Tested on Ubuntu 24.04 as a non-root user with isolated state, dependencies, ports, and network ranges.

  • make agentenv-server with OpenAPI Generator 7.22.0
  • make fmt
  • make clippy
  • cargo test -p agentenv --lib snapshot_volume_replacement
  • make test-unit — 1206 passed, plus shell checks; CLI tests serialized
  • 15_volume.sh — 56 assertions, including both endpoints and empty arrays
  • 16_volume_randomized.sh — 1696 assertions; Compose, seed 21106, 50 steps
  • E2B TypeScript SDK 2.58.0 volume compatibility and mount serialization checks
  • Documentation updated

Risks and reviewer notes

Empty arrays intentionally count as explicit replacement requests.

Checklist

  • One coherent change with regression coverage.
  • Schema and generated models updated together.
  • Examples and logs contain no credentials.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kvcache-ai/AgentENV/pull/405 **Author:** [@Primary33](https://github.com/Primary33) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@yingdi-shan](https://github.com/yingdi-shan) **Base:** `main` ← **Head:** `fix/reject-snapshot-volume-replacement` --- ### 📝 Commits (1) - [`7e8eb75`](https://github.com/kvcache-ai/AgentENV/commit/7e8eb75e9a72d1e856e2fa153e7ca3d525e7dfad) fix: reject explicit volume mounts on snapshots with volumes ### 📊 Changes **7 files changed** (+79 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `CLAUDE.md` (+2 -1) 📝 `docs/src/concepts/sandboxes/starting.md` (+1 -1) 📝 `docs/src/concepts/volumes/sandbox-forks-and-snapshots.md` (+5 -0) 📝 `scripts/tests/e2e/suites/15_volume.sh` (+23 -0) 📝 `src/api/generated/src/models.rs` (+2 -0) 📝 `src/api/impls/sandbox.rs` (+38 -0) 📝 `src/api/openapi.yml` (+8 -0) </details> ### 📄 Description ## 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 - API: previously accepted replacement requests now return HTTP 400. E2B JS SDK 2.58.0 omits the field by default; explicit empty mounts serialize as `[]`. - Configuration, snapshot format, and host requirements: unchanged. ## Validation Tested on Ubuntu 24.04 as a non-root user with isolated state, dependencies, ports, and network ranges. - [x] `make agentenv-server` with OpenAPI Generator 7.22.0 - [x] `make fmt` - [x] `make clippy` - [x] `cargo test -p agentenv --lib snapshot_volume_replacement` - [x] `make test-unit` — 1206 passed, plus shell checks; CLI tests serialized - [x] `15_volume.sh` — 56 assertions, including both endpoints and empty arrays - [x] `16_volume_randomized.sh` — 1696 assertions; Compose, seed 21106, 50 steps - [x] E2B TypeScript SDK 2.58.0 volume compatibility and mount serialization checks - [x] Documentation updated ## Risks and reviewer notes Empty arrays intentionally count as explicit replacement requests. ## Checklist - [x] One coherent change with regression coverage. - [x] Schema and generated models updated together. - [x] Examples and logs contain no credentials. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 14:23:05 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/AgentENV#408
No description provided.