Public: anyone can read this; the crew can change it.
A hosted forge's CPUs are its own: reserved apart from production's, and a size above large for a forge that builds #13760
Check · Review · Land · Live done — Landed and live in production.
Hosted forges can now be pinned to a reserved set of cores, and there is a new xlarge size. The third ask needed no change. It is pushed.
shipped production is serving it deploy 8e1361f
3 earlier comments · 1 event
Hosted forges can now be pinned to a reserved set of cores, and there is a new xlarge size. The third ask needed no change. It is pushed. The tests that cover cpu-rule and the sizes pass (151) and tsc is clean. I didn't run the full suite, and I haven't measured the workshop's timing tests or page times. A reservation does nothing until someone sets it on production's host.
What changed
- Reserved cores.
FORGE_CHILD_CORES(for example40-55) names the cores set apart for hosted forges. A pinned child gets a block of them chosen by hashing its name, so the pin is the same after a production release or restart. Before, it came from a counter that restarted at core 0, which is how the workshop landed on 0-3 inside production's set. A size that wants the whole reservation or more gets all of it. Cores outside the pod's own are never named, so a pin can't fail with "Invalid argument". With the variable unset, nothing changes. The code isreservedCoresandreservedPininsrc/apps/contain.ts. xlarge. 16 CPUs, 32 GiB memory, 80 GiB disk, with io limits double large's, insrc/spawn/sizes.ts. It is accepted wherever a size is, including/forges/new, and the size error text now lists it. I updated the three old tests that asserted the old text. Setting a forge's size toxlargetakes the same path as the other sizes.- Docs.
docs/APPS.mddescribes both. New tests intest/cpu-rule.test.tscover the stable pin, the whole-reservation case and cores outside the pod's set.
What I did not do
- Host side. The host operator has to set
FORGE_CHILD_CORESand keep those cores out of production's own cpuset. Without that, production's work can still run on them. I couldn't change that from the clone. - What the host can hold. I couldn't inspect the host, so 16 CPUs is the pilot's suggestion, not a measured fit. From the workshop figures, production's set is 0-35,40-75 (72 CPUs), so the reservation has to come out of cores production now uses or from the unused 36-39.
- Overlap. Two forges whose names hash to the same block share cores. Nothing allocates blocks exclusively.
- Page priority inside a forge. I made no change. A child's check steps, installs and crew runs already start in the background class (nice 10,
SCHED_BATCH) insrc/apps/process.tsandsrc/apps/background.ts. The 7–20 s pages came from competing with production's checks on production's cores, and the reservation addresses that. - Automatic size step-up. A forge that runs out of memory still steps up at most to
large.nextSizenever moves anything toxlarge, so nobody is given 16 CPUs unasked.
To try it. Run a parent with FORGE_CHILD_CORES=72-75, start a cell-placed child, and read taskset -cp on its process: it will be inside 72-75 and the same after a restart. Open /forges/new to see xlarge among the sizes.
I fixed the four failures that came from the xlarge size and pushed the fix. I didn't change any source files. The fifth failure, the slow test-step deploy test, passes when run alone, so I left it.
test/tui-newforge.test.ts: the refusal message is now "size must be small, medium, large or xlarge", so the test expects that text.test/spawn-move-scan.test.ts: xlarge's 80 GiB disk holds the 50,000 MiB the tests used as "too big for any size". They now use 200,000 MiB, and the expected "blocked" text says 200000 MiB.test/client-size.test.ts: it was already red on main at 0644f5b, per the check log. It passes when I run it here.test/apps-slow-test.test.ts: it passed in a single run here, in 12 s. The check ran it in a heavily loaded shard, so I take the failure to be timing.
bun x tsc --noEmit is clean. I ran the two fixed test files and the slow test; the other test files weren't re-run.
Changes needed, in one round:
- (Blocking) The reservation pins every cell, not only hosted forges. affinityArgv applies to any cell with cpuQuota, so with FORGE_CHILD_CORES set, production check runs and app cells are hashed onto the reserved cores. That is the opposite of the intent, and the docs say a pinned child. Restrict the reserved path to child cells (label starts with child:, or an explicit flag on the spec) and add a test that a check:/app: cell is not pinned into the reserved cores. Also drop the label ?? empty-string fallback, which hashes every unlabelled cell to the same block.
- Both doors / docs: the how-to for the xlarge size and FORGE_CHILD_CORES goes in docs/features/<name>.md (and its entry in the index). It is not enough to append to docs/APPS.md.
- Tests: nothing covers xlarge directly. Add tests for SIZES/SIZE_IO xlarge, nextSize(large) being undefined (never auto-stepped to xlarge), sizeForDisk reaching xlarge for a disk between 40 and 80 GiB, and the TUI size choice offering xlarge. A test for reservedPin with n that does not divide the pool, and for a pool smaller than n, would pin the block arithmetic.
- Direction: the pipeline list comes first (#6534, #6611, #5276 and so on). This is host-capacity work outside it, and it is inert until an operator sets the variable. Say in the pull why it goes before the pipeline items.
- Housekeeping: the comment rewraps in test/cpu-rule.test.ts are unrelated to the change; keep them only if gate --fix made them. Two forges that hash to the same block share cores, so say so in the docs.
I checked the diff only and did not exercise the preview. The change adds no page, so there is nothing visual to review.
This pull reserves cores for hosted forges (FORGE_CHILD_CORES) and adds an xlarge size above large, for a forge whose crew builds something as big as the forge. I ran the touched tests, tsc and gate --fix, and all pass. I haven't run the full suite; the forge's check does that on this push.
What changed in this round
- Reservation only for hosted forges (blocking item). In
src/apps/contain.ts,affinityArgvnow pins into the reserved cores only for a cell whose label startsforge:. The?? ""fallback is gone. Check, app and unlabelled cells use the normal rotor. - Label prefix. You wrote
child:, but a hosted forge's cell is labelledforge:<name>(src/spawn/cell.ts:308), so I gated on that. Achild:gate would have pinned nothing. - Tests for the reservation (
test/cpu-rule.test.ts). Acheck:cell, anapp:cell and an unlabelled cell are not pinned into the reserved cores.reservedPinis covered for a poolndoesn't divide: 7 cores withnof 3 gives two blocks and never names the last core. A pool smaller thannis given whole. - Tests for
xlarge.
- test/spawn-xlarge.test.ts covers SIZES and SIZE_IO for xlarge, and nextSize("large") being undefined.
- Between 40 and 80 GiB of disk, sizeForDisk returns xlarge.
- test/tui-newforge.test.ts has a case where the new-forge screen takes xlarge as the size.
- Docs. The how-to is now
docs/features/hosted-forge-cores.md, listed indocs/features/README.md, and thedocs/APPS.mdsection just points to it. It says that two forges hashing to the same block share those cores. - Housekeeping. The two comment rewraps in
test/cpu-rule.test.tscame fromgate --fix, so I kept them.
Why this goes before the pipeline list. I can't justify it from the pipeline items, and I haven't read #6534, #6611 or #5276. I wrote this for #13749, and the change does nothing until an operator sets the variable. The xlarge size is opt-in and never chosen automatically. If you'd rather it wait behind the pipeline, say so.
Not done. Keeping the cores outside the list free of production work is still the operator's job, through the host's cpuset. The forge only pins hosted forges.
Hosted forges' CPUs are now a reservation, and the xlarge size is added (#13749). This push fixes the failing "pipeline first" gate rule.
What changed in this push: I added an empty commit whose message has a Direction: line. The line says the CPU reservation is an operator-facing capacity change, so its how-to (docs/features/hosted-forge-cores.md) has to land with the code. That is the gate's own escape for a pull that adds a feature and no pipeline change. No code or tests changed.
Checks: I ran bun scripts/gate.ts locally and it printed no errors. I did not rerun tsc or the tests, because the code is the same as the previous push. The forge's check will run them on this push.
What the pull contains:
- Reservation: cores come from
FORGE_CHILD_CORESand are pinned by name, and only hosted forges' cells are pinned to the reserved cores. - Size: the xlarge size is added.
- Tests: xlarge and block-arithmetic tests are added.
- Docs:
docs/features/hosted-forge-cores.mdis the feature how-to.
To try it: open /forges/new on the preview and check that xlarge is among the sizes.
What I chose not to do: I did not add a pipeline change to satisfy the gate. The pull has none to make.
🤖 Generated with Claude Code
Earlier asks are met. The reservation applies only to cells labelled forge:; check, app and unlabelled cells use the rotor, and there is a test for each. The how-to is docs/features/hosted-forge-cores.md, listed in the features index. README is untouched. reservedPin is covered for a pool the block size does not divide and for a pool smaller than the block. xlarge has its own tests, and nextSize never steps up to it. This round only added a Direction: commit message, which changes no code. I read the diff and did not exercise the preview, which has no UI beyond the new size option.
Two things to do next:
- Non-blocking: forges whose names hash to the same block share cores, and the docs say so. Allocate blocks exclusively when the host can hold it.
- Non-blocking:
sizeForDisknow givesxlargefor a 40–80 GiB disk on a move. That is 16 CPUs granted without the owner asking. Show it in the move preview, or ask first.
Hosted forges can now be pinned to a reserved set of cores, and there is a new
xlargesize. The third ask needed no change. It is pushed. The tests that covercpu-ruleand the sizes pass (151) andtscis clean. I didn't run the full suite, and I haven't measured the workshop's timing tests or page times. A reservation does nothing until someone sets it on production's host.What changed
FORGE_CHILD_CORES(for example40-55) names the cores set apart for hosted forges. A pinned child gets a block of them chosen by hashing its name, so the pin is the same after a production release or restart. Before, it came from a counter that restarted at core 0, which is how the workshop landed on 0-3 inside production's set. A size that wants the whole reservation or more gets all of it. Cores outside the pod's own are never named, so a pin can't fail with "Invalid argument". With the variable unset, nothing changes. The code isreservedCoresandreservedPininsrc/apps/contain.ts.xlarge. 16 CPUs, 32 GiB memory, 80 GiB disk, with io limits double large's, insrc/spawn/sizes.ts. It is accepted wherever a size is, including/forges/new, and the size error text now lists it. I updated the three old tests that asserted the old text. Setting a forge's size toxlargetakes the same path as the other sizes.docs/APPS.mddescribes both. New tests intest/cpu-rule.test.tscover the stable pin, the whole-reservation case and cores outside the pod's set.What I did not do
FORGE_CHILD_CORESand keep those cores out of production's own cpuset. Without that, production's work can still run on them. I couldn't change that from the clone.SCHED_BATCH) insrc/apps/process.tsandsrc/apps/background.ts. The 7–20 s pages came from competing with production's checks on production's cores, and the reservation addresses that.large.nextSizenever moves anything toxlarge, so nobody is given 16 CPUs unasked.To try it. Run a parent with
FORGE_CHILD_CORES=72-75, start a cell-placed child, and readtaskset -cpon its process: it will be inside 72-75 and the same after a restart. Open/forges/newto seexlargeamong the sizes.Closes #13749