merge_into to commit the winner’s state back into the parent. The parent’s sandbox id remains valid and now points to the winner’s VM — so any callers holding a reference to the parent id continue working without interruption. The winner’s id is retired after the merge.
Request
The parent sandbox id — the one you originally forked from.
The child sandbox id whose state should replace the parent’s. This is typically one of the ids returned by a previous
fork call on this parent.Response
Returns204 No Content on success. There is no response body.
Examples
What happens during merge
The merge is atomic from the perspective of the in-memory VM registry:- Both the parent and winner entries are removed from the sandbox registry simultaneously.
- The parent’s Firecracker process is sent
SIGKILLand its working directory is deleted. - The winner’s VM handle is re-inserted under the parent’s id.
merge_into returns:
parent.idis a valid sandbox id pointing to the winner’s underlying VM.winner.idis no longer a live sandbox. The SDKs mark the winner object as defunct soclose()on it becomes a no-op and does not attempt a double-destroy.- Sibling children are not touched. If you forked
n=5and one child is the winner, the other 4 are still live — destroy them explicitly.
Typical pattern
Idempotency and edge cases
Merging the same winner a second time returns
404 — the winner id no longer exists after the first merge. Merging a sandbox into itself returns 400.Error responses
| Status | Body | Cause |
|---|---|---|
400 | {"error": "..."} | Parent and winner are the same id |
401 | {"error": "invalid api key"} | Missing or invalid bearer token |
404 | {"error": "sandbox not found"} | Parent or winner id does not exist |
500 | {"error": "..."} | Internal error during VM swap |