mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #374] [MERGED] refactor(sandbox): reach guest envd through one backend method #386
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#386
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/374
Author: @yingdi-shan
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @yingdi-shan
Base:
main← Head:refactor/envd-call-helper📝 Commits (1)
7a9731crefactor(sandbox): reach guest envd through one backend method📊 Changes
8 files changed (+165 additions, -152 deletions)
View changed files
📝
src/orchestrator/sandbox_metrics.rs(+4 -4)📝
src/orchestrator/service.rs(+38 -36)📝
src/orchestrator/tests.rs(+76 -9)📝
src/sandbox/backend.rs(+6 -24)📝
src/sandbox/envd.rs(+33 -8)📝
src/sandbox/firecracker/sandbox.rs(+2 -22)📝
src/sandbox/mock.rs(+5 -49)📝
src/sandbox/mod.rs(+1 -0)📄 Description
What
EnvdApitrait insrc/sandbox/envd.rs, implemented byEnvdInstance.SandboxBackendexposes that API once, throughfn envd(&self) -> Option<Arc<dyn EnvdApi>>. It replaces the per-call methodsmetrics_sampleandlogs_query.running_envd().Why
Each guest-facing feature has repeated the same plumbing. #311 (metrics) and #338 (logs) each:
SandboxBackendmethod that captures a future under the runtime lock;FirecrackerSandboxand inMockSandboxBackend, with a new mock closure type (MetricsSampler,LogsReader);After this PR, a new guest call (process list, file watch, and so on) adds an
EnvdApimethod and its caller. The backend trait, the Firecracker backend and the mock stay unchanged.Related issue
N/A. Follow-up to the review behind #367.
Scope and non-goals
pause,snapshot, volume freeze and thaw, and so on) stay onSandboxBackend.try_lock, skipping busy sandboxes, and generation checks. It only swapsmetrics_sample()forenvd()?.metrics().Design and behavior changes
envd()is called under the runtime lock and only clones a handle;Runningunder the lock.FakeEnvdon the mock backend. It runs the same test closures as before, so the existing tests still prove that guest I/O does not hold the runtime-map or backend lock.Compatibility and operations
Validation
make fmtmake clippymake test-unitmake -C services test(required whenservices/changes)maketargetCommands and results:
Skipped checks and reasons:
make test-unitcapability tests (--ignored) and the Firecracker integration suites need/dev/kvm, ublk and capabilities. The Firecracker change is a 3-lineenvd()that clones the existingenvd_instance; the metrics and logs bodies inEnvdInstanceare unchanged and keep their HTTP-level tests insrc/sandbox/envd.rs.Risks and reviewer notes
src/orchestrator/service.rs(running_envd) andsrc/sandbox/backend.rs.envd()is a required trait method with no default. Any out-of-treeSandboxBackendimplementation must add it; there are none in this repository.Checklist
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.