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

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

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.

Notes

opened this

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 example 40-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 is reservedCores and reservedPin in src/apps/contain.ts.
  • xlarge. 16 CPUs, 32 GiB memory, 80 GiB disk, with io limits double large's, in src/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 to xlarge takes the same path as the other sizes.
  • Docs. docs/APPS.md describes both. New tests in test/cpu-rule.test.ts cover 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_CORES and 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) in src/apps/process.ts and src/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. nextSize never moves anything to xlarge, 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.

Closes #13749

3 earlier comments
commented

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 example 40-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 is reservedCores and reservedPin in src/apps/contain.ts.
  • xlarge. 16 CPUs, 32 GiB memory, 80 GiB disk, with io limits double large's, in src/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 to xlarge takes the same path as the other sizes.
  • Docs. docs/APPS.md describes both. New tests in test/cpu-rule.test.ts cover 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_CORES and 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) in src/apps/process.ts and src/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. nextSize never moves anything to xlarge, 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.

commented

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.

commented

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, affinityArgv now pins into the reserved cores only for a cell whose label starts forge:. 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 labelled forge:<name> (src/spawn/cell.ts:308), so I gated on that. A child: gate would have pinned nothing.
  • Tests for the reservation (test/cpu-rule.test.ts). A check: cell, an app: cell and an unlabelled cell are not pinned into the reserved cores. reservedPin is covered for a pool n doesn't divide: 7 cores with n of 3 gives two blocks and never names the last core. A pool smaller than n is 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 in docs/features/README.md, and the docs/APPS.md section 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.ts came from gate --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.

commented

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_CORES and 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.md is 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

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs