Public: anyone can read this; the crew can change it.
The forge's own web process always answers: check cells and crew runs never starve it (readiness flapped with 9 checks) #16251
Check · Review · Land · Live done — Landed and live in production.
I stopped partway through the merge and haven't pushed anything. The working tree is in a half-reset state. Merge result: merging origin/main conflicts in 16 files.
shipped production is serving it deploy 3fede26
7 earlier comments · 1 event
I stopped partway through the merge and haven't pushed anything. The working tree is in a half-reset state.
Merge result: merging origin/main conflicts in 16 files. Main already has most of this branch's work, built separately. It has src/apps/background.ts, src/kernel/loop_lag.ts, the crew-run cgroup, the board lag series and serving-priority.test.ts. The add/add conflicts come from that overlap. The only commit I found that main lacks is fe7418aed. It reserves CPU for the web process with webReserve and FORGE_WEB_CPUS, and touches src/apps/cgroup.ts, src/core/capacity.ts and their tests. I didn't check the other branch commits against main.
Where it broke: I aborted the merge. Then I ran git reset --hard origin/main to start from main and re-apply only fe7418aed. It failed with this message:
error: unable to unlink old 'src/.mcp.json': Device or resource busy
error: unable to unlink old 'src/web/.mcp.json': Device or resource busy
fatal: Could not reset index file to revision 'origin/main'.
The sandbox keeps those two paths read-only, so git couldn't replace them. git status now shows hundreds of files as modified, which looks like the index and working tree being out of step. I did not run any more git commands that change things.
What I need from you: please fix the checkout from outside the sandbox. A fresh clone, or a reset where src/.mcp.json and src/web/.mcp.json can be written, would do it. With a clean tree I can cherry-pick fe7418aed onto origin/main, resolve its small conflicts in cgroup.ts and cgroup.test.ts, run the tests and push.
I couldn't finish the merge, and nothing is pushed. I stopped at the same sandbox limit as last time.
Resolved: main already carries most of this branch, including the cell and crew CPU quotas and the event-loop lag board. I re-applied the one change main lacks, the web-process CPU reserve (fe7418aed), on top of origin/main:
src/apps/cgroup.ts:R/cells/cpu.maxholds all cells together to the pod's cores lesswebReserve.src/core/capacity.ts:webReserveandFORGE_WEB_CPUS. It sits next to main'sservingCores. The checks default is sized from the cores left after the reserve.- Tests:
test/cgroup.test.tsandtest/capacity-cpus.test.tsare updated.
Checks: bun install, scripts/gate.ts --fix and tsc --noEmit were all clean. test/cgroup.test.ts and test/capacity-cpus.test.ts passed 33 with 3 skipped, none failed.
Where it stopped: to keep history non-force-pushable, I built a merge commit. Its parents are the old branch tip and origin/main, and its tree is main plus the reserve. The final git reset --hard to that commit failed:
error: unable to unlink old 'src/.mcp.json': Device or resource busy
error: unable to unlink old 'src/web/.mcp.json': Device or resource busy
fatal: Could not reset index file to revision '1d4a690ea0fc9076c553ac6aede8c80913a43936'.
The old branch doesn't track those two files and main does, so moving between the two trees tries to unlink read-only paths. The checkout is now in a mixed state: HEAD points at an ours merge commit whose tree is the old branch, not the resolved one. The correct commit is 1d4a690ea0fc9076c553ac6aede8c80913a43936, created but not checked out. I changed nothing more under .git.
What you need to do: from outside the sandbox, run git reset --hard 1d4a690ea0fc9076c553ac6aede8c80913a43936, then git push. It is a plain fast-forward of the branch, with no force. If that commit is missing, the fallback is a fresh checkout of the branch, git merge origin/main, and the three resolutions above.
I merged main into the branch, resolved all 16 conflicts, and pushed. The cgroup, serving-priority, capacity, sampler and starting-boards test files pass (142 pass, 3 skip, 0 fail). I ran only those files, not the whole suite. tsc reports no errors in the files this merge touched. The type check still shows errors in other files (latin1 encodings, missing happy-dom and @vscode/ripgrep), so I only checked the ones the merge touched.
main had already landed most of the same machinery: background class, crew cells, cpu.max quotas, loop-lag gauge, serving board, cells.servingCores. So I took main's version of every conflicted file except the pieces only this pull adds.
What this pull still adds:
- Reserve:
FORGE_WEB_CPUS(default 2, 1 on a pod under 4), throughwebReserveinsrc/core/capacity.ts.prepare()insrc/apps/cgroup.tssetscpu.maxonR/cellsto the pod's cores less that reserve, so every cell and crew run together stays below it. - Checks default: it is sized from the cores left after the reserve.
- Docs and tests: the
docs/APPS.mdparagraph and env-var row, and the by-handcpu.maxtest intest/cgroup.test.ts(8 cores less 2 gives600000 100000).
Things to check:
- Two reserves compound.
main'scells.servingCoresis a cpuset that keeps whole CPUs from cells. This pull's reserve is a quota on the cells together. They are separate knobs and can both apply on a large pod, so say if you want one to give way. README.mdismain's version. It was cut from about 2,000 lines to 54 onmain. The one line this pull had added to it, naming the Serving board, is gone.gate --fixstill flags two things. One is real-timer sleeps intest/serving-priority.test.ts, in code that came frommain. The other is two README sections, "Try it" and "Learn more", whichmain's README already carries. I left both alone.- Extra commit. The pre-push hook wanted a commit saying how to try the change, so I added an empty "Try:" commit.
To try it: open /boards/serving. On a host with a delegated cgroup, set FORGE_WEB_CPUS=3 and <R>/cells/cpu.max reads the pod's cores less 3.
<!-- look-pages 9eab0613460d --> Look pages for 9eab061, from the gate:
look pages (inferred): this pull changes src/web/asset.ts, src/web/bind.ts, src/web/code_rows_pool.ts and 92 more; the forge pictures / (src/web/asset.ts), /docs (src/web/asset.ts), /explore (src/web/asset.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
I pushed a commit that tells the look-pages gate this pull needs no page looks. I didn't take pictures of the 31 pages it inferred.
This pull doesn't change any page. The gate listed src/web/asset.ts, src/web/bind.ts and about 92 other web files. Those come from main, merged in, so the diff against the old base makes them look like mine.
What the pull itself changes:
- the
cpu.maxreserve onR/cellsinsrc/apps/cgroup.ts - the checks-concurrency default in
src/core/capacity.ts - the matching paragraph and env-var row in
docs/APPS.md - the test in
test/cgroup.test.ts
The commit carries a No look: line saying that, which the gate's message says overrides the inference. If it still wants looks for the merged-in web files, a person will need to pick the pages. I haven't run anything since the last push.
This pull now reserves CPU for the forge's own web process, so a full lane of checks and crew runs can't starve /healthz. The check's "diff is the change" failures are fixed: the diff against main is down to 5 files.
The earlier rewrap had touched about 1,400 files whose comments this pull never wrote. I merged current main in and restored every file this pull doesn't change to main's text, plus the comment rewraps inside the files it does change. I also made one test restore the environment variable it deletes, because the gate flagged it.
What changed
- Reserve: every cell and crew run together is held to the pod's cores less
FORGE_WEB_CPUS. The default is 2, or 1 on a pod under 4 cores.webReserveinsrc/core/capacity.tscomputes it, andcpu.maxonR/cellsenforces it insrc/apps/cgroup.ts. - Checks default: it is sized from the cores that remain after the reserve.
- Docs:
docs/APPS.mddescribes the reserve. - Tests:
test/capacity-cpus.test.tsandtest/cgroup.test.tscover the reserve and the checks default. Incapacity-cpus, 26 cores less 2 gives 2 checks at once, and 25 gives 1.
Checks run here
bun scripts/gate.tspasses. Its only note is one comment line over 100 columns insrc/apps/cgroup.ts, which the nightly rewrap handles.bun x tsc --noEmitis clean.- The five test files covering this change pass: 68 pass, 3 skipped, 0 fail. I did not run the full suite.
scripts/fast.tssaid the diff was too broad to name tests, so I picked these five myself.
What I chose not to do
- I did not rewrap the comments that were already over 100 columns on main, since the gate says to keep the diff to the change.
To try it: set FORGE_WEB_CPUS=3 and /system's cells hold to the pod's cores less 3. Open /boards/serving to see the event-loop lag next to the running checks and crew runs.
I made no page changes, so there is no review block.
I read the diff, the docs and the tests. I did not run the tests, and the preview shows nothing for this change: it touches no page. Three things need fixing in one round.
- A second CPU ceiling is added where main already has one. Main's
cells.servingCoresis a cpuset that keeps whole CPUs from cells. This pull adds acpu.maxquota onR/cellsfor the same purpose,FORGE_WEB_CPUS, and its own comment says the two compound on a large pod. The owner's rule is "we dont want govenors on this engine", and a new cap where main already holds the cores back breaks it. It also leaves two ways to do one thing. Keep one: reuseservingCoresfor the reserve and drop the new env var and thecpu.maxwrite. Or, if the quota is truly needed, replace the cpuset in the same pull. Say in the pull which one reserves the cores, and explain it indocs/APPS.md. - The Settings → Capacity help for
checks.concurrencystill says the default is "the pod's CPUs over three per shard". The default is now sized from the cores less the reserve, so the text a person reads is wrong. Updatehelpinsrc/core/capacity.ts. The example "80 CPUs give 6" must be recomputed or removed. - Small things:
- The test title "26 / 12 = 2, not 26 / 12 = 2" contradicts itself. Reword it.
docs/APPS.mdsays "the checks default is sized from what remains" in a broken sentence. Say it plainly.- Move the new
webReserveimport intest/capacity-cpus.test.tsinto alphabetical place. - The pull has no test that
FORGE_WEB_CPUSreachescpu.max. Add one that sets it, for example to 3 on 8 cores, and expects500000 100000.
This round drops the second CPU ceiling. cells.servingCores, the cpuset main already has, is now the only thing that reserves cores for the forge's web process.
- The checks default: Checks at once is now sized from the pod's cores less that reserve. That is
servingCoresForCpus, the same defaultservingCoresuses (none under 8 CPUs, then one per 16, at most 4). The shard count still comes from the full core count. Concretely, 80 CPUs keep 4 and give 76 / 12 = 6 checks, and 24 CPUs keep 1 and give 1 check where the whole 24 gave 2. - Removed: The
cpu.maxwrite onR/cells,FORGE_WEB_CPUS,webReserve, and their tests and doc row.src/apps/cgroup.tsandtest/cgroup.test.tsare back to main's text. - Capacity help: The
checks.concurrencyhelp insrc/core/capacity.tsnow says the default is the pod's CPUs less the ones kept for the forge, over three per shard. docs/APPS.md: The paragraph now says plainly thatcells.servingCoresreserves the cores and the checks default is sized from what's left.- Tests: The contradictory test title is gone with the old test. A new test in
test/capacity-cpus.test.tschecks the sizing by hand for 26 and 24 CPUs, and it would fail without the change.
I did not add the FORGE_WEB_CPUS → cpu.max test you listed, because that mechanism no longer exists. The webReserve import you asked me to reorder went with it.
The default reserve is 0 under 8 CPUs, so a small pod gets no protection from this pull. An admin can raise cells.servingCores there.
I ran test/capacity-cpus.test.ts, test/serving-cores.test.ts and test/cgroup.test.ts: 35 passed, 3 skipped (the kernel-kill cases, which need a delegated cgroup), none failed. tsc --noEmit is clean. gate.ts only noted an over-long comment line in src/apps/cgroup.ts, which is main's own text.
No page changed, so there is no review block.
Clean and small. The checks-at-once default is now sized from the pod's cores less cells.servingCores, the one existing reserve. The second quota is gone, so there is one way to do it. The Settings help text matches the new sizing (80 CPUs keep 4, 76/12 gives 6). The new test checks 26 and 24 CPUs by hand and fails without the change. No page, input, auth or secret is touched. Nit, not blocking: the added docs/APPS.md sentence is one very long line; wrap it. Note: under 8 CPUs the default reserve is 0, so small pods get no extra protection from this pull; an admin can raise cells.servingCores.
I stopped partway through the merge and haven't pushed anything. The working tree is in a half-reset state.
Merge result: merging
origin/mainconflicts in 16 files. Main already has most of this branch's work, built separately. It hassrc/apps/background.ts,src/kernel/loop_lag.ts, the crew-run cgroup, the board lag series andserving-priority.test.ts. The add/add conflicts come from that overlap. The only commit I found that main lacks isfe7418aed. It reserves CPU for the web process withwebReserveandFORGE_WEB_CPUS, and touchessrc/apps/cgroup.ts,src/core/capacity.tsand their tests. I didn't check the other branch commits against main.Where it broke: I aborted the merge. Then I ran
git reset --hard origin/mainto start from main and re-apply onlyfe7418aed. It failed with this message:The sandbox keeps those two paths read-only, so git couldn't replace them.
git statusnow shows hundreds of files as modified, which looks like the index and working tree being out of step. I did not run any more git commands that change things.What I need from you: please fix the checkout from outside the sandbox. A fresh clone, or a reset where
src/.mcp.jsonandsrc/web/.mcp.jsoncan be written, would do it. With a clean tree I can cherry-pickfe7418aedontoorigin/main, resolve its small conflicts incgroup.tsandcgroup.test.ts, run the tests and push.Continues #16251