Repository navigation
Checkpoint a Managed Agents computer on park and roll it back on restart - #2156
Merged
16francej merged 3 commits intoOct 9, 2026
Conversation
The portable home tar survives a destroyed session, but it is not the provider's machine-state checkpoint. Call CreateCheckpoint while the session is still running so the live microVM is captured before pause. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
🟡 Changes recommended
Checkpoint throttling breaks after snapshot failures, and failed checkpoint deletions cannot be retried.
2 open findings
What changed in this PR
Adds Managed Agents checkpoints during teardown while retaining portable home snapshots as the cross-session recovery path.
Changes:
- Adds checkpoint creation, validation, deletion, and durable status metadata.
- Captures checkpoints before home snapshots and pause.
- Expands fake services, tests, and preservation documentation.
| File | Description |
|---|---|
src/sandbox/managed-agents-client.ts |
Adds checkpoint REST operations. |
src/sandbox/managed-agents-sandbox.ts |
Integrates checkpoint lifecycle into teardown and status. |
test/managed-agents-client.test.ts |
Tests checkpoint API behavior. |
test/managed-agents-sandbox.test.ts |
Tests teardown capture, failure, throttling, and replacement. |
test/support/fake-managed-agents.ts |
Adds checkpoint support to the sandbox fake. |
test/support/fake-managed-agents-service.ts |
Implements fake checkpoint HTTP routes. |
docs/sandbox-preservation.md |
Documents checkpoint-based preservation. |
adrs/managed-agents-sandbox-backend.md |
Updates the backend architecture flow. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
A failed delete used to drop the only reference to the previous checkpoint, and a failed home tar cleared the capture throttle because both shared lastSnapshotMs. Co-authored-by: Cursor <cursoragent@cursor.com>
Restart calls the harness rollback API so the same session boots a new microVM from the stored capture. Co-authored-by: Cursor <cursoragent@cursor.com>
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.

Summary
POST /v2/agents/sessions/{id}/checkpoints(CreateCheckpoint) before the portable home tar and pause. The call is throttled byDO_AGENTS_SNAPSHOT_INTERVAL_SEC(default five minutes). There is no timer; a turn that never opens the computer does not capture.recovery.errorand the session still pauses. The portable tar remains the recovery path when the session itself is gone, because a checkpoint is bound to its session.sandboxaction=restartcallsPOST /v2/agents/sessions/{id}/checkpoints/{checkpoint_id}/rollbackwith the stored checkpoint. The session id stays, the response's sandbox id replaces the stored one, and any open port-forward is closed. Restart does not take a new checkpoint first. A paused session is rolled back directly. Restart with no stored checkpoint fails and leaves the session as it is.Stacked on #2128.
Test plan
node --experimental-test-module-mocks --test test/managed-agents-sandbox.test.ts test/managed-agents-client.test.ts(58 passed)scripts/managed-agents-sandbox-smoke.ts) against a real Managed Agents token, confirming teardown returns aREADYcheckpoint before pause anddoctl harness-runtime rollbackrewinds that session onto a new sandbox