fix(sandbox): roll back resources after start failures - #45
Open
morluto wants to merge 2 commits into
Open
Conversation
Contributor
|
✅ OpenCodeReview: No comments generated. Looks good to me. |
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.
Problem
Direct calls to
FirecrackerSandbox::start()returned after startup or readiness errors without awaiting cleanup. Fresh startup also applied fallible egress-policy configuration before attaching the allocated network slot to the sandbox.Together, these paths could retain daemon-managed ublk resources or leave a network slot unavailable after a failed start.
Changes
start_nowait()andwait_for_ready()as one public-start transaction.stop()after either operation fails.Existing orchestrator cleanup,
Drop, and daemon shutdown behavior are unchanged.Commit structure
fix(sandbox): roll back failed direct startsfix(sandbox): retain network slot on policy failureThe commits are separate because public-start transactionality and network-slot ownership are independently reviewable and revertible.
Validation
cargo test -p agentenv --lib sandbox::firecracker::sandbox::tests::— 14 passed.cargo clippy -p agentenv --lib -- -D warningscargo fmt --allThe network ownership test uses the existing deterministic test-slot seam. A full base-failing
start_freshintegration test would require privileged networking, ublk setup, and an additional injection seam, so this PR does not add production-wide mocking for that path.Closes #42.