mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #103] [MERGED] fix(sandbox): isolate envd bootstrap connections across generations #180
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#180
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/103
Author: @leether
Created: 8/1/2026
Status: ✅ Merged
Merged: 8/1/2026
Merged by: @yingdi-shan
Base:
main← Head:leether/fix-envd-bootstrap-pr102📝 Commits (1)
facc249fix(sandbox): isolate envd bootstrap connections across generations📊 Changes
1 file changed (+122 additions, -4 deletions)
View changed files
📝
src/sandbox/envd.rs(+122 -4)📄 Description
What
GET /healthandPOST /init;Why
AgentENV reuses interaction IPs across sandbox runtime generations, while the process-wide reqwest client pooled idle connections by HTTP origin (
scheme + IP + port). The pool key does not include the sandbox runtime generation.After snapshot restore, a later runtime can therefore receive the same interaction IP while the host client still holds a TCP connection from the previous runtime. If the restored guest also contains the matching TCP tuple, the host and guest can be in different TCP sequence spaces. An envd health or init request may then stall until the TCP user timeout instead of establishing a fresh connection.
The packet-level reproduction, controls, and full stress evidence are in #102. The issue was discovered during ARM64 snapshot validation in #101, but the lifecycle condition is not architecture-specific.
Related issue
Closes #102
Related:
Scope and non-goals
This PR changes only
src/sandbox/envd.rs:This PR does not change:
tools.ext4;Design and behavior changes
The shared bootstrap client is now built with:
For a successful bootstrap, health and init therefore use separate TCP connections. Failed health retries also open fresh connections. This prevents a bootstrap request from checking out a socket retained from a previous VM generation.
Command execution remains on the separately created gRPC
ProcessClient, so repeated exec calls are unaffected. The patch intentionally does not add.no_proxy()or.http1_only()because proxy routing and protocol negotiation are independent behaviors.The regression test:
accept()as connecting to the next VM assigned the same address;With
pool_max_idle_per_host(1)as a local negative control, the test fails because init reuses the first socket. With0, it passes.Compatibility and operations
Validation
make fmtmake clippymake test-unitmake -C services test(required whenservices/changes)maketargetCommands and results:
The benchmark is evidence that the observed stall is removed, not a controlled A/B attribution of sub-second latency. Post-fix cold means were
168.50–182.34 ms; hot means were119.81–124.81 ms. Full sample ranges and the deeper sequential/concurrent stress results are recorded in #102.Skipped checks and reasons:
fc::multiple_resumes_have_independent_disk_statedownstream.make -C services testwas not run becauseservices/is unchanged.make test-unitwas therefore run with the command-lineCAPABILITY_RUNNERoverride shown above; this PR intentionally does not include an unrelated Makefile change.Risks and reviewer notes
TIME_WAIT. The concurrent stress run reported in #102 returned to zero orphan sockets within 20 seconds and file-handle allocation returned close to baseline.bootstrap_http_client_does_not_reuse_connectionstest insrc/sandbox/envd.rs.Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.