Repository navigation
Recommend node limits from the host - #806
Merged
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
SaladDay
force-pushed
the
recommend-node-limits-from-the-host
branch
2 times, most recently
from
October 21, 2026 05:49
2432480 to
1714325
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every sandbox node got the fixed limits Sandboxes at once 2 and Retained sandboxes 8, whatever the machine, so new conversations queued on large hosts. The literals lived in the enrollment table defaults, the Core API, Web's Add node and Edit node, and Web had a separate browser-only hint.
Design
deployment.RecommendCapacity(formula owned by sandbox-deployment.md#recommended-capacity): Sandboxes at once = min(⌊2 × CPUs / sandbox CPUs⌋, ⌊(memory − 2 GiB) / sandbox memory⌋), at least 1; CPUs are the cgroup-effective cores when reported. Retained sandboxes = max(active, ⌊free disk / 2 / root disk⌋) for a provider that checkpoints, else equal to active (existing capability rule, no provider names). CPU counts twice because agent sandboxes mostly wait on the model; memory is never overcommitted.cpu_count,effective_cpu_cores,total_memory_bytes,available_disk_bytes), validated like health. Wire file, protocol doc and the node implementation change together.max_activeormax_retainedis stored unset (migration000003drops the 2/8 defaults); at enrollment Core fills each unset limit from the recommendation, then retained = max(retained, active) and the provider rule apply. Explicit limits and later edits bind as before. An unset limit without host measurements fails with 409sandbox_node_host_unmeasuredand leaves the token unused./core/v1nodes carryrecommended_capacityfor the latest health and the current specification (null without either); Web uses it and the browser-side hint is deleted.max_active/max_retainedfields (only validated by the Python installer, never used) are removed.Measured host
mx2 (microsandbox, 4 vCPU, 14.4 GiB memory, 239 GiB free, Standard size 2 CPU / 4 GiB / 8 GiB root disk): 3 at once and 14 retained instead of 2 and 8. Its 8 retained checkpoints took 140–190 MiB each on disk; a suspended sandbox uses no memory.
mx e2e
Fresh install on mx of
e2e-805-806(main + #805 + this PR) from a release-shaped offline archive; mx2 enrolled through Add node with the default Recommended. README~/.oac/tests/e2e-acceptance-20261020, logslogs/run-pr806/.Tests run
go testforservices/core/internal/deployment/...,internal/sandbox/node,internal/api, the changeddeploymentpgtests and the integration testTestRuntimeEnrollmentCapacityPrecedesResetConflict(Postgres 16 container);go vetof the touched packages;make check-openapi.RecommendCapacity(mx2 → 3/14, a host fitting one sandbox → 1/1, cgroup-limited CPUs, provider without checkpoints);TestEnrollmentDerivesUnsetLimitsFromHost(omitted, partial, explicit, unmeasured).tscforpackages/agents-clientandapps/web; Vitest for the touched Web folders; Python node tests;pnpm check-translations.apps/web/e2e/nodes.spec.ts(no browser here); it runs in this PR's web-acceptance job.Need help on this PR? Tag
@codesmith-botwith what you need.