[PR #216] feat: enable virtio-mem for firecracker #260

Open
opened 2026-10-29 14:21:34 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/AgentENV/pull/216
Author: @RuoqingHe
Created: 8/25/2026
Status: 🔄 Open

Base: main ← Head: enable-virtio-mem-for-fc


📝 Commits (10+)

  • dc423ab feat(config): introduce firecracker virtio-mem hotplug policy
  • b22765b feat(firecracker): persist virtio-mem device state
  • f0f5259 feat(firecracker): add virtio-mem data plane operations
  • 45a568e feat(sandbox): add virtio-mem resize lifecycle
  • 334aa20 feat(api): define sandbox memory resize contract
  • cfeb64d chore(api): generate memory resize bindings
  • 897b698 feat(orchestrator): add memory resize state
  • 092ca7f feat(orchestrator): implement memory resize lifecycle
  • 54cd5cd test(sandbox): extend mock resize backend
  • b9afb77 test(orchestrator): cover memory resize lifecycle

📊 Changes

23 files changed (+3322 additions, -29 deletions)

View changed files

📝 config/default.toml (+11 -0)
📝 docs/src/configuration/reference.md (+34 -0)
📝 src/api/generated/src/apis/sandboxes.rs (+67 -0)
📝 src/api/generated/src/models.rs (+528 -0)
📝 src/api/generated/src/server/mod.rs (+439 -0)
📝 src/api/impls/sandbox.rs (+196 -7)
📝 src/api/openapi.yml (+172 -0)
📝 src/cfg.rs (+204 -1)
📝 src/orchestrator/metrics.rs (+1 -0)
📝 src/orchestrator/mod.rs (+21 -1)
📝 src/orchestrator/service.rs (+529 -5)
📝 src/orchestrator/tests.rs (+281 -0)
📝 src/orchestrator/types.rs (+40 -0)
📝 src/sandbox/backend.rs (+17 -2)
📝 src/sandbox/firecracker/config.rs (+29 -1)
📝 src/sandbox/firecracker/factory.rs (+29 -3)
📝 src/sandbox/firecracker/instance.rs (+127 -2)
📝 src/sandbox/firecracker/mod.rs (+1 -0)
📝 src/sandbox/firecracker/sandbox.rs (+385 -2)
📝 src/sandbox/manifest.rs (+16 -0)

...and 3 more files

📄 Description

What

Add hard virtio-mem memory resize support to Firecracker-backed AgentENV
sandboxes.

Why

AgentENV currently treats sandbox memory as fixed after boot. Firecracker
supports virtio-mem, but AgentENV does not expose a validated or
lifecycle-aware way to grow and shrink guest memory.

Scope and non-goals

Included:

  • Firecracker virtio-mem hard resize.
  • Sandbox and orchestrator lifecycle integration.
  • Public memory resize and status endpoints.
  • Snapshot and legacy manifest compatibility.

Design and behavior changes

Public API

The PR adds:

  • GET /sandboxes/{sandboxId}/memory
  • PATCH /sandboxes/{sandboxId}/memory
    Responses distinguish:
  • Requested memory.
  • Observed plugged memory.
  • Converged state.
  • Partial or unknown state.
  • Unsupported legacy backends.
  • Invalid requests.
  • Lifecycle conflicts.
  • Gateway timeout.

Compatibility and operations

  • Public API or generated protocol:
  • Configuration or defaults:
  • Snapshot manifest, artifact layout, or storage format:
  • Upgrade and rollback:
  • Host requirements, permissions, ports, or dependencies:

Validation

  • make fmt
  • make clippy
  • make test-unit
  • Relevant Rust integration tests
  • make -C services test (required when services/ changes)
  • Generated clients/server regenerated with the documented make target
  • Documentation updated
  • Benchmarks or performance comparison completed

Commands and results:


Skipped checks and reasons:

Risks and reviewer notes

Checklist

  • The PR contains one coherent change and no unrelated formatting or refactoring.
  • New behavior is covered by tests, or I explained why testing is impractical.
  • Logs and examples contain no credentials, tokens, or private registry information.
  • I did not manually edit generated code without updating its source and regenerating it.

🔄 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/216 **Author:** [@RuoqingHe](https://github.com/RuoqingHe) **Created:** 8/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `enable-virtio-mem-for-fc` --- ### 📝 Commits (10+) - [`dc423ab`](https://github.com/kvcache-ai/AgentENV/commit/dc423aba9bd9c4f91bd2167f020c331804db29a0) feat(config): introduce firecracker virtio-mem hotplug policy - [`b22765b`](https://github.com/kvcache-ai/AgentENV/commit/b22765bc40882b98a3fae71ee02c8f6278f1f674) feat(firecracker): persist virtio-mem device state - [`f0f5259`](https://github.com/kvcache-ai/AgentENV/commit/f0f5259566a870eb98c5359704e19603deb4ff21) feat(firecracker): add virtio-mem data plane operations - [`45a568e`](https://github.com/kvcache-ai/AgentENV/commit/45a568e08fda1aa318a5d9d3c07b43a1d464919f) feat(sandbox): add virtio-mem resize lifecycle - [`334aa20`](https://github.com/kvcache-ai/AgentENV/commit/334aa206591f91940291b22c93a5865e4d6eafc5) feat(api): define sandbox memory resize contract - [`cfeb64d`](https://github.com/kvcache-ai/AgentENV/commit/cfeb64d230dd54fa334e67263661921574517572) chore(api): generate memory resize bindings - [`897b698`](https://github.com/kvcache-ai/AgentENV/commit/897b698636e46c515fbf7ea563202fdc0e45c426) feat(orchestrator): add memory resize state - [`092ca7f`](https://github.com/kvcache-ai/AgentENV/commit/092ca7f689eec993e56f08eda12b943fd86f522f) feat(orchestrator): implement memory resize lifecycle - [`54cd5cd`](https://github.com/kvcache-ai/AgentENV/commit/54cd5cd6699c57cb1163617bfa32fb719d5680ef) test(sandbox): extend mock resize backend - [`b9afb77`](https://github.com/kvcache-ai/AgentENV/commit/b9afb77216625e4c4db5337378386d3896bf31ea) test(orchestrator): cover memory resize lifecycle ### 📊 Changes **23 files changed** (+3322 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `config/default.toml` (+11 -0) 📝 `docs/src/configuration/reference.md` (+34 -0) 📝 `src/api/generated/src/apis/sandboxes.rs` (+67 -0) 📝 `src/api/generated/src/models.rs` (+528 -0) 📝 `src/api/generated/src/server/mod.rs` (+439 -0) 📝 `src/api/impls/sandbox.rs` (+196 -7) 📝 `src/api/openapi.yml` (+172 -0) 📝 `src/cfg.rs` (+204 -1) 📝 `src/orchestrator/metrics.rs` (+1 -0) 📝 `src/orchestrator/mod.rs` (+21 -1) 📝 `src/orchestrator/service.rs` (+529 -5) 📝 `src/orchestrator/tests.rs` (+281 -0) 📝 `src/orchestrator/types.rs` (+40 -0) 📝 `src/sandbox/backend.rs` (+17 -2) 📝 `src/sandbox/firecracker/config.rs` (+29 -1) 📝 `src/sandbox/firecracker/factory.rs` (+29 -3) 📝 `src/sandbox/firecracker/instance.rs` (+127 -2) 📝 `src/sandbox/firecracker/mod.rs` (+1 -0) 📝 `src/sandbox/firecracker/sandbox.rs` (+385 -2) 📝 `src/sandbox/manifest.rs` (+16 -0) _...and 3 more files_ </details> ### 📄 Description ## What Add hard virtio-mem memory resize support to Firecracker-backed AgentENV sandboxes. ## Why AgentENV currently treats sandbox memory as fixed after boot. Firecracker supports virtio-mem, but AgentENV does not expose a validated or lifecycle-aware way to grow and shrink guest memory. ## Related issue ## Scope and non-goals Included: - Firecracker virtio-mem hard resize. - Sandbox and orchestrator lifecycle integration. - Public memory resize and status endpoints. - Snapshot and legacy manifest compatibility. ## Design and behavior changes ### Public API The PR adds: - `GET /sandboxes/{sandboxId}/memory` - `PATCH /sandboxes/{sandboxId}/memory` Responses distinguish: - Requested memory. - Observed plugged memory. - Converged state. - Partial or unknown state. - Unsupported legacy backends. - Invalid requests. - Lifecycle conflicts. - Gateway timeout. ## Compatibility and operations <!-- Explain applicable compatibility and deployment impact. Write "N/A" with a reason where appropriate. --> - Public API or generated protocol: - Configuration or defaults: - Snapshot manifest, artifact layout, or storage format: - Upgrade and rollback: - Host requirements, permissions, ports, or dependencies: ## Validation <!-- Check only commands you actually ran. Add focused tests and exact commands below. --> - [ ] `make fmt` - [ ] `make clippy` - [ ] `make test-unit` - [x] Relevant Rust integration tests - [ ] `make -C services test` (required when `services/` changes) - [ ] Generated clients/server regenerated with the documented `make` target - [x] Documentation updated - [ ] Benchmarks or performance comparison completed Commands and results: ```text ``` Skipped checks and reasons: ## Risks and reviewer notes <!-- Identify correctness, security, compatibility, resource, and operational risks. Point reviewers to the most important files or commits. --> ## Checklist - [x] The PR contains one coherent change and no unrelated formatting or refactoring. - [x] New behavior is covered by tests, or I explained why testing is impractical. - [x] Logs and examples contain no credentials, tokens, or private registry information. - [x] I did not manually edit generated code without updating its source and regenerating it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#260
No description provided.