Skip to content

Regenerate from API and add build memory and volume to sandbox image push - #26

Merged
cretz merged 5 commits into
mainfrom
mstolarz/sandbox-image-build-sizes
Oct 15, 2026
Merged

cretz merged 5 commits into
mainfrom
mstolarz/sandbox-image-build-sizes

Conversation

@SystemSculpt

@SystemSculpt SystemSculpt commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🚀 What

ImageClient.push() and AsyncImageClient.push() take memory and volume, in MB, named like memory on sandbox create, to size the temporary environment that builds or imports an image. This is for large images that run out of memory or disk while building. It works for every push source: builder, directory, files, zip and registry image.

💻 How

  • Spec: adds the API's new fields to the vendored management.json: memory and volume on the push request, and upload_headers on the response. Then regenerates with poe generate-api, so a later spec refresh produces no diff here. Regenerate full spec
  • Request: the options are omitted when None, and volume=0 is sent; it builds in memory.
  • Upload: when sizes are set, the upload URL is signed for the returned upload_headers, so the PUT sends them as given. Without sizes nothing changes.

🔬 Testing

  • Six new tests, sync and async:
    • sizes are sent and the upload sends the returned headers;
    • volume=0 is sent and the upload adds nothing extra;
    • registry imports pass the sizes.
  • poe lint, poe typecheck and poe test pass (428 passed; the e2e tests are skipped without credentials). Regenerating produces no diff.
  • The API side was verified live against a pre-release deployment:
    • an upload without the headers is rejected with 403, and with them the image builds;
    • the sizes reach the build environment.

The generated models enforce the spec's ranges, so an out-of-range value raises a ValidationError before any request, as sandbox memory already does.

Merge after the API change is in production.

Carries build_memory and build_volume on the image push request, and
upload_headers on its response, from the server's spec change, and
regenerates the client. The spec is patched rather than downloaded, since
the live spec does not have the change yet.
ImageClient.push and AsyncImageClient.push take build_memory and
build_volume, in megabytes, for every source, and send them only when
set, so a build_volume of 0 is sent. The build context upload sends the
upload_headers a push returns, which its upload URL is signed for, and
nothing more when there are none.
Copilot AI balanced review requested due to automatic review settings October 13, 2026 22:05
@CLAassistant

CLAassistant commented Oct 13, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ cretz
❌ SystemSculpt
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

🟢 Approval recommended

The specification, generated models, client paths, and tests are consistent with no blocking defects found.

0 open findings

What changed in this PR

Adds configurable build memory and scratch volume for sandbox image pushes across all supported sources.

Changes:

  • Extends API schemas and generated models with build sizing and upload headers.
  • Forwards sizing options in synchronous and asynchronous clients.
  • Applies signed headers during archive upload and adds test coverage.
File Description
baseten/​sandbox/​_images.py Implements sizing options and signed upload headers.
baseten/​client/​managementapi/​_models.py Adds generated request and response fields.
scripts/​apigen/​specs/​management.json Updates the management API specification.
tests/​sandbox/​test_images.py Tests sync and async push behavior.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

SystemSculpt and others added 3 commits October 13, 2026 16:21
Follows the server's rename: the push endpoint only builds, so no build
prefix, and the unit is in the name.
Matches the unitless memory field, in megabytes, that the other sandbox options and API schemas use. images.push's memory_mb and volume_mb become memory and volume, sent as memory and volume. Values stay integers in MB.
@cretz cretz changed the title Add build memory and volume to sandbox image push Regenrate from API and add build memory and volume to sandbox image push Oct 15, 2026
@cretz
cretz merged commit b795de6 into main Oct 15, 2026
4 of 5 checks passed
@cretz
cretz deleted the mstolarz/sandbox-image-build-sizes branch October 15, 2026 13:38
@cretz cretz changed the title Regenrate from API and add build memory and volume to sandbox image push Regenerate from API and add build memory and volume to sandbox image push Oct 15, 2026
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