Skip to content

feat: wire up memory_mb and cpus in builds API#108

Merged
hiroTamada merged 4 commits intomainfrom
feat/build-vm-resources-options
Feb 26, 2026
Merged

feat: wire up memory_mb and cpus in builds API#108
hiroTamada merged 4 commits intomainfrom
feat/build-vm-resources-options

Conversation

@hiroTamada
Copy link
Contributor

@hiroTamada hiroTamada commented Feb 26, 2026

Summary

  • Parses memory_mb and cpus fields from the multipart form data in the /builds endpoint
  • Added memory_mb and cpus to the /builds endpoint's OpenAPI schema so they appear in generated SDKs
  • Fixed: negative values now treated as "use default" in ApplyDefaults()
  • Added maximum limits: 8 vCPUs and 16GB memory - returns 400 if exceeded

Test plan

  • Verify build with custom memory_mb value uses the specified memory
  • Verify build with custom cpus value uses the specified CPU count
  • Verify builds without these fields continue to use defaults
  • Verify negative values use defaults (not rejected or passed through)
  • Verify cpus > 8 returns 400 error
  • Verify memory_mb > 16384 returns 400 error

Note

Medium Risk
Changes how build resource limits are accepted and validated, which can affect builder VM sizing and build scheduling. Risk is mitigated by added server-side bounds checks and defaulting behavior.

Overview
Wires memory_mb and cpus through the POST /builds multipart handler so callers can request builder VM memory/CPU alongside timeout_seconds, and rejects out-of-range values with a 400 via new BuildPolicy.Validate() limits.

Updates the OpenAPI schema (and regenerated swaggerSpec/SDK types) to expose memory_mb and cpus, and tweaks BuildPolicy.ApplyDefaults() to treat non-positive values as “use defaults”.

Written by Cursor Bugbot for commit cec8115. This will update automatically on new commits. Configure here.

@github-actions
Copy link

github-actions bot commented Feb 26, 2026

✱ Stainless preview builds

This PR will update the hypeman SDKs with the following commit message.

feat: wire up memory_mb and cpus in builds API
hypeman-openapi studio · code

Your SDK build had at least one "note" diagnostic.
generate ✅

⚠️ hypeman-typescript studio · code

Your SDK build had at least one "error" diagnostic.
generate ❗build ✅lint ✅test ✅

npm install https://pkg.stainless.com/s/hypeman-typescript/262294908012266f80a4ac22e90bd716f140bf4a/dist.tar.gz
hypeman-go studio · code

Your SDK build had at least one "note" diagnostic.
generate ✅lint ✅test ✅

go get github.com/stainless-sdks/hypeman-go@ed09f5a0bc3c60e7ccf6da1101d23311107c7118

This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-02-26 19:46:40 UTC

Parse the existing memory_mb and cpus fields from the multipart form
data in the /builds endpoint. These fields were already defined in
the OpenAPI spec but were not being read by the API handler.

Made-with: Cursor
@hiroTamada hiroTamada force-pushed the feat/build-vm-resources-options branch from 0a57bea to 7d4d062 Compare February 26, 2026 18:52
@hiroTamada hiroTamada changed the title feat(builds): add VM resource configuration and build options feat: wire up memory_mb and cpus in builds API Feb 26, 2026
Document memory_mb and cpus as form fields in the /builds endpoint
so they appear in generated SDKs (e.g., hypeman-go).

Made-with: Cursor
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

hiroTamada added 2 commits February 26, 2026 14:13
Change ApplyDefaults() to use <= 0 instead of == 0 for TimeoutSeconds,
MemoryMB, and CPUs. This prevents negative values from bypassing
defaults and causing VM creation failures.

Made-with: Cursor
- Max 8 vCPUs and 16GB memory for builder VMs
- Returns 400 error if limits exceeded

Made-with: Cursor
@hiroTamada hiroTamada merged commit 3ae1b0b into main Feb 26, 2026
6 checks passed
@hiroTamada hiroTamada deleted the feat/build-vm-resources-options branch February 26, 2026 19:43
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.

2 participants