Skip to content

feat(sandbox): keep an unsized deploy_sandbox step's cpu and memory unset - #497

Merged
kaihackney-scale merged 7 commits into
mainfrom
kai/fd-5242-5241-default-sizing
Nov 19, 2026
Merged

kaihackney-scale merged 7 commits into
mainfrom
kai/fd-5242-5241-default-sizing

Conversation

@kaihackney-scale

@kaihackney-scale kaihackney-scale commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A deploy_sandbox step that sets no cpu or memory now keeps them unset (None) on the step and in its stored dict, instead of writing 1.0 and 8192. It still reserves 1 vCPU and 8 GiB when it deploys (DEFAULT_CPU / DEFAULT_MEMORY_MB), so no sandbox changes size.

This lets a reader tell a size the step chose apart from one it left to the default. Hub-side sizing writes explicit sizes onto tasks from measured usage (scaleapi#174094) and needs that distinction to know which steps it may size.

  • to_dict leaves an unset size out, so a reader that predates this never sees a null.
  • from_dict keeps any stored size as written; only a field the dict leaves out is unset.
  • execute resolves the default at deploy time and logs the size it actually reserves.

An earlier version of this PR added a runtime [sandbox.sizer] seam and cpu_source / memory_source attribution. Both were dropped: sizes are now written onto tasks explicitly.

Testing

tst/unit/task_step/deploy_sandbox_default_cpu_test.py: an unsized step stays unsized whether built in code or loaded from a dict, still reserves 1 vCPU / 8 GiB, and a stored size is kept as written. CI is green.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

This PR appears safe to merge; no blocking issues were found.

Summary

Unsized deploy_sandbox steps now keep CPU and memory unset without changing the resources requested at deployment.

  • Unsized sandbox steps keep CPU and memory unset until deployment.

No new actionable issues found. The earlier findings are addressed by preserving stored sizes and removing runtime sizing.

Reviews (12) · Last reviewed commit: "refactor(sandbox): drop the runtime size..." · Reviewed by Greptile

t and others added 2 commits November 4, 2026 15:42
A deploy_sandbox step that sets no cpu or memory still reserves 1 vCPU and
8 GiB, but now keeps both as None on the step and in its stored dict
instead of writing 1.0 and 8192. A size the step chose can then be told
apart from one it left to the default, which a default sizer needs.

Steps stored with explicit values keep them; nothing else reads these
fields.

FD-5242

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eave unset

[sandbox.sizer] names a SandboxSizer (impl/config, as [runner]). For each of
cpu and memory, deploy_env, deploy_agent and deploy_sandbox reserve the step's
own value, else the sizer's, else the step's or the provider's default. The
in-tree default sizer chooses nothing, so without the table nothing changes.

Each sandbox's attribution gains cpu_source and memory_source (step, sizer or
default), so a deployment can see which sizes it set.

FD-5241

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kaihackney-scale
kaihackney-scale requested a review from a team as a code owner November 4, 2026 22:29
t and others added 2 commits November 4, 2026 17:36
In container mode only the gateway gets the step's memory; its MCP servers,
sidecars and service db are created with cpu alone, so they get the
provider's memory. Their attribution said the step's memory source anyway.
They now carry memory_source "default".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t fail a deploy

- The sizer is passed vm=True when a step may deploy onto a VM: a vm-mode
  deploy_sandbox, or a deploy_env/deploy_agent whose sandbox type names a
  backend that creates VMs (may_create_vm, read from the classes).
- A sizer that raises or returns something other than a SandboxSize is logged
  and taken to choose nothing.
- A stored deploy_sandbox step with the old default pair (1.0, 8192), which
  every unsized step was saved with, reads as unsized; to_dict leaves an unset
  size out rather than writing null.
- A gateway's containers that don't take the step's memory get the source
  "provider", so their events aren't read as sized.
- cpu_source/memory_source stay out of the names, labels and tags boat,
  daytona, sail_vm, coreweave and tenki build from attribution.
- [sandbox] sizer = "pkg:Cls" works at runtime, as describe already accepted.

FD-5241, FD-5242

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
t and others added 3 commits November 9, 2026 13:17
…aved 1.0/8192

A container-mode deploy_sandbox on a VM backend (modal_vm) runs in a VM of its own whose
memory is the size chosen, so the sizer is now told vm=True for it too.

A step that sets cpu=1.0 and memory_mb=8192 is now saved with size_set, so a reload keeps
the pair instead of reading it as a step stored before sizes could be unset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A stored cpu=1.0 / memory_mb=8192 was read as unset when it carried no size_set marker,
so a step saved with that size before this change could be resized by a sizer. A stored
size is now always the step's own; only a field the dict leaves out is unset. The
size_set marker is no longer needed and is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sizes

Sizes now live on the task: measured usage suggests them and a person applies them as a
task edit, so nothing chooses a size while a run deploys. This removes the [sandbox.sizer]
seam (sizing.py, may_create_vm, the size-source attribution keys and the provider name
hygiene that went with them) and leaves deploy_env and deploy_agent as on main.

deploy_sandbox keeps the part that stands on its own: cpu and memory_mb may be unset (None),
an unset size is left out of the stored dict, a stored size is kept as written, and an unset
size reserves 1 vCPU / 8 GiB as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kaihackney-scale kaihackney-scale changed the title feat(sandbox): let a configured sizer choose the sizes deploy steps leave unset feat(sandbox): keep an unsized deploy_sandbox step's cpu and memory unset Nov 19, 2026
@kaihackney-scale
kaihackney-scale merged commit 48fe231 into main Nov 19, 2026
35 checks passed
@kaihackney-scale
kaihackney-scale deleted the kai/fd-5242-5241-default-sizing branch November 19, 2026 00:01
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.

3 participants