Skip to content

fix(app): keep the sandbox resource fields inside the dialog, and explain them - #245

Merged
quickbeard merged 5 commits into
mainfrom
fix/sandbox-dialog-resources
Aug 16, 2026
Merged

quickbeard merged 5 commits into
mainfrom
fix/sandbox-dialog-resources

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

Two problems with the CPU and Memory fields in Add sandbox, both visible in the screenshot: the memory box hung off the right edge, and neither field said what it does or what you get by leaving it empty.

The overflow

TextInputV2 sets its own width: 280px and flex: none:

[data-component="text-input-v2"] { … width: 280px; … flex: none; }

So two of them in a flex row don't share the space — they take 560px of a 448px row and the second one hangs off the end. flex-1 and min-w-0 are both no-ops against a fixed width on a flex: none item, and plain w-full loses to the component's rule. !w-full is what the rest of the app already uses for this (dialog-edit-project-v2.tsx, dialog-manage-models.tsx), and a grid grid-cols-2 sizes the pair.

Measured in the running app rather than eyeballed:

before after
Row right edge 864 864
CPUs field 416 → 688 416 → 636
Memory field 704 → 976 644 → 864

Both now end flush with the row.

I left the project-folder and image rows alone: their input-plus-button layout fits today, and changing them would be unvalidated churn.

The descriptions

Both fields are optional and both have real defaults, which an empty box cannot convey. Each placeholder now carries its default (CPUs (default 4), Memory GB (default 4)), and a line underneath explains what the numbers buy — including that the memory is held for as long as the sandbox runs, since a sandbox is a virtual machine rather than a container.

The defaults were bare literals in the vz backend (config.cpus ?? 4). They are now named constants there and mirrored in the app, so the dialog cannot quote a number the VM does not actually use; the range message is interpolated from the same constants for the same reason.

Why these fields are macOS-only

Unchanged, but worth recording since it prompted the question: only the vz backend can apply per-sandbox limits, because each sandbox is its own VM and the values go into its boot config. WSL2 shares one utility VM whose limits live in the user's global .wslconfig, and bubblewrap has no cgroup plumbing here — neither provider reads config.cpus/config.memoryMiB at all. Showing the fields there would be offering a setting that silently does nothing.

Verified by driving the running desktop app: screenshot confirms both fields inside the dialog with defaults and description. packages/app 675 pass, packages/codev-sandbox 146 pass, typecheck clean in app / codev-sandbox / desktop.

🤖 Generated with Claude Code

quickbeard and others added 5 commits August 16, 2026 12:40
…lain them

The memory box ran past the right edge of the Add sandbox dialog. TextInputV2
sets its own `width: 280px` and `flex: none`, so two of them in a flex row do
not share the space — they take 560px of a 448px row and the second one hangs
off the end. Neither flex-1 nor min-w-0 helps against a fixed width, and w-full
loses to the component's rule; `!w-full` is what the rest of the app uses, and
grid tracks size the pair. Measured in the running app: the memory field ended
at x=976 against a dialog edge of 880, and now ends at 864 with the row.

Both fields were also unexplained. They are optional and both have real
defaults, which an empty box cannot convey, so the dialog now shows the default
in each placeholder and describes what the numbers buy — including that the
memory is held for as long as the sandbox runs, since a sandbox is a VM.

The defaults were literals in the vz backend; they are now named constants
there and mirrored in the app, so the dialog cannot quote a number the VM does
not actually use. The range message is interpolated from the same constants
for the same reason.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The image hint spent a sentence explaining when to pick a file, which the
field's own "(optional)" placeholder and the first sentence already convey,
and the idle form carried a standing warning that the first sandbox downloads
its image — advice that arrives before the user has done anything and stays up
while they fill the form in.

The status line now speaks only while something is happening: queued, or
creating. A download says what it is doing with the byte counter under the
progress bar, so nothing is lost.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The folder hint ended on "and the agent edits files in them without asking",
which reads as a warning at the moment someone is picking a folder — and the
permission model is a property of the sandbox, not of this field. Dropped, and
the surrounding em-dash aside folded into the sentence so it does not read as
though something was cut out of it.

"Memory GB (default 4)" put the unit on the label and left the default looking
unitless; "Memory (default 4 GB)" reads as the quantity it is.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every other field in Add sandbox is introduced by the line above it; the CPU
and memory description sat underneath, so it read as a footnote to boxes the
user had already had to guess at. Moved above the pair, and the dialog now
reads the same way throughout: what the field is for, then the field.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The hint restated the defaults that each placeholder already carries and the
ceilings that the out-of-range message states when they matter, so two thirds
of it was there to be skipped. What is left is the part nothing else says: the
numbers are a claim on this machine, and a VM holds its memory the whole time
it runs.

The interpolation goes with it — the string no longer quotes any number, so it
no longer needs the constants passed in.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@quickbeard
quickbeard merged commit 658e209 into main Aug 16, 2026
0 of 5 checks passed
@quickbeard
quickbeard deleted the fix/sandbox-dialog-resources branch August 16, 2026 13:00
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.

1 participant