Restore a sandbox to one of its own snapshots - #230
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.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
Exposes the new controlplane endpoint
POST /sandboxes/{sandboxName}/snapshots/{snapshotId}/restore(blaxel-ai/controlplane#5290) in the SDK: the client is regenerated from the controlplane OpenAPI onmain, and both the async and syncSandboxInstancegain a wrapper next tosnapshot/list_snapshots/fork.Unlike
fork, restore is in place: the sandbox keeps its name, URLs and previews, only the instance behind it is rebuilt from the snapshot, so anything written after the snapshot is lost. Likefork, the call returns as soon as the restore is accepted, without waiting for the instance.Regenerating also pulled in the schedule endpoints/models the OpenAPI definition has gained since the last generation (
list_schedules,get_sandbox_schedule_metrics, …) — generated-only, no hand-written code depends on them.The integration test (
tests/integration/core/sandbox/test_snapshots.py) writes a file, snapshots, writes a second file, restores, and asserts the first file is back and the second is gone. It is opt-in behindRUN_SLOW_TESTSbecause a full snapshot + restore round trip takes minutes.Link to Devin session: https://app.devin.ai/sessions/b07a2ea049fb42c2a3598005bdc86bbb
Open in Devin Desktop: https://app.devin.ai/desktop/session/b07a2ea049fb42c2a3598005bdc86bbb?variant=devin
Requested by: @drappier-charles
Note
Medium Risk
Restore is destructive (rebuilds the live instance and drops post-snapshot state) and the SDK does not wait for readiness; callers must handle downtime like fork. Large generated client surface and enum/sort changes could affect code that relied on removed sort values.
Overview
Adds in-place sandbox restore to the SDK: regenerated client for
POST /sandboxes/{name}/snapshots/{id}/restoreand newrestore(snapshot_id)on async and syncSandboxInstance, returningSandboxRestoreResponse. Unlike fork, the sandbox keeps its name and URLs while the instance is rebuilt from the snapshot; the call returns when the restore is accepted, not when the guest is back up.OpenAPI regeneration also brings in workspace-level schedule observability (
GET /schedules,/schedule-executions,/schedules/metrics) plus model tweaks:sandboxand executionstatuson schedule records, new metrics types, and removal ofnamesort options from sandbox-scoped schedule list enums (workspace list enums are separate).Integration coverage adds an opt-in slow test (
RUN_SLOW_TESTS) that snapshots, mutates the FS, restores, and asserts filesystem rollback. Test helpers gain mk3.1 gating via workspace featuregeneration_mk31(skip_unless_generation_mk31, optionalBL_REQUIRE_GENERATION_MK31=1) andBL_REGIONoverride for default region.Reviewed by Cursor Bugbot for commit f98d087. Bugbot is set up for automated code reviews on this repo. Configure here.