Skip to content

Sync spec and add sandbox volume support - #36

Merged
cretz merged 6 commits into
mainfrom
cretz/sandbox-volumes
Oct 29, 2026
Merged

cretz merged 6 commits into
mainfrom
cretz/sandbox-volumes

Conversation

@cretz

@cretz cretz commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

🚀 What

  • Sandbox volume support: create, get, list, update and delete volumes, and mount them on sandboxes
  • Image cleanup now loops until all images are deleted, with an optional progress callback
  • Bump black and certifi (Dependabot)

Cannot merge until backend spec deployed

💻 How

  • Spec synced and clients regenerated
  • VolumeClient / AsyncVolumeClient in baseten/sandbox/_volumes.py, as client.volumes
  • SandboxVolumeMount, with volumes on sandbox create and SandboxInfo
  • size is str | int, same as filesystem max_memory_usage; ImageLibraryVolume.size_mb renamed to size
  • Image cleanup keeps calling while has_more is set and adds up deleted; progress runs between calls (can be async on the async client)

🔬 Testing

  • Unit and parity tests
  • New e2e test_volume_crud (async) and test_volume_mount (sync) pass on staging
  • Fixed the preview e2e test that asked for a token outliving its preview

@cretz
cretz requested review from cploujoux and a balanced review from Copilot October 28, 2026 15:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The test can fail on a healthy but slower sandbox because it performs filesystem operations without first polling for the sandbox to reach DEPLOYED, with a timeout and failure-state check.

1 open issue
What changed in this PR

Adds persistent volume support to the sandbox SDK and synchronizes the management API specification and generated clients. The PR remains dependent on deployment of the backend specification.

Changes:

  • Adds synchronous and asynchronous volume management, sandbox mounts, and related test coverage.
  • Makes image cleanup repeat until complete, with optional progress callbacks.
  • Refreshes generated API models, updates Black and certifi, and corrects preview-token expiry in end-to-end tests.
File Description
uv.lock Updates Black and certifi.
tests/​sandbox/​test_volumes.py Tests volume operations, pagination, and errors.
tests/​sandbox/​test_parity.py Extends API parity checks for volumes and cleanup.
tests/​sandbox/​test_images.py Tests repeated cleanup and progress callbacks.
tests/​sandbox/​test_e2e.py Adds volume lifecycle tests and adjusts preview-token expiry.
tests/​sandbox/​test_client.py Tests mount serialization and response mapping.
scripts/​apigen/​specs/​management.json Synchronizes volume endpoints, cleanup fields, and other API changes.
baseten/​sandbox/​_volumes.py Implements synchronous and asynchronous volume clients.
baseten/​sandbox/​_info.py Adds volume mount types and conversions.
baseten/​sandbox/​_images.py Adds cleanup looping and callbacks; renames library volume size.
baseten/​sandbox/​_client.py Exposes volume clients and sandbox creation mounts.
baseten/​sandbox/​__init__.py Exports volume and cleanup progress types.
baseten/​client/​managementapi/​_models.py Regenerates models from the updated specification.
baseten/​client/​managementapi/​_client.py Adds generated volume API methods.
baseten/​client/​managementapi/​__init__.py Exports newly generated models.

Review effort: Balanced

Comment thread tests/sandbox/test_e2e.py Resolved
@cretz
cretz merged commit 2a6f510 into main Oct 29, 2026
11 of 13 checks passed
@cretz
cretz deleted the cretz/sandbox-volumes branch October 29, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants