Public: anyone can read this; the crew can change it.
A spawn that would pass the host's child quota is refused with one sentence, and the New forge form says so before it is filled in #5843
Merged 38d 2h ago, live in production
A spawn that would pass a declared child quota is now refused with a 409 refused and one sentence naming the limit. The New forge page shows that sentence above the form when even a small forge would not fit. The new quota tests and test/new-forge.test.ts pass unchanged (17 tests), and tsc --noEmit is clean.
-
Reviews
Changes requested — before the latest pushThe refusal itself is sound: it is enforced in make() for every door, only for new children, and the tests cover unset, invalid, full and per-size. One miss against the list: the issue says the New forge form says so before it is filled in, and only the web page does. src/tui/screens/newforge.ts shows the quota sentence only after a failed submit, so a terminal user fills in the whole form first. Fix first: have the terminal new-forge screen call quotaFull(app.config.dataDir) when it opens and show the sentence in its status line, and add a tty test for it. Also: the New menu (layout.ts forgeDoor, via noRoom) still offers New forge as enabled when the quota is full, so consider feeding quotaFull into the same disabled reason. And the page uses class error with role=status for a standing notice; role=alert is not needed, but check docs/DESIGN.md for the named notice component instead of the error class.
ApprovedApproved. The quota is opt-in (unset means no limit), the check sits only on the new-child path in make(), the 409 gives one sentence, and the page, New menu and terminal all say it. Tests cover unset, invalid, full and per-size cases. The notice is plain markup that matches the existing "cannot hold another child" line, and DESIGN.md names no notice component. The preview has no FORGE_CHILD_* set, so I could not see the sentence there; the tests cover it. Next, in order: (1) layout.ts calls quotaFull on every page render for every person, and with a limit set that is a synchronous readdir plus a JSON parse of each ledger file. Cache the held sum briefly or invalidate it when the ledger changes, to keep common requests under 50 ms. (2) The check and the ledger write are not atomic, so two concurrent spawns can both pass the last slot. Re-check after placing, or serialise the check and the write.
-
Checks
shipped production is serving it deploy 7cefc8d
-
History
- The terminal's New forge and the New menu say the child quota before the form is filled in d4da110
- A spawn past the host's declared child quota is refused in one sentence, and New forge says so first c11c1cd
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:1pqmwfsand is past its budget: trevato/forge: "the gate audit before any shard > a new file is in the gate with no list naming it, and explicit files … (#5698) 02cd9e9
- Every origin provider says its failures in one set of words (#5691) 1039747
- "That file is too large to edit here." and "That could not be changed." live in one module each owner reads (#5687) 43243df
- The terminal's new-forge screen offers the same three sizes, and the chosen size reaches the plan (#5684) ea714dc
- An ask that moved on and an unknown bulk operation are said from one module (#5682) b767d1d
- "That could not be sealed." lives in one module, read by the backup destination and the mirror (#5630) 3f29c8c
- A pull's re-check and conflict sentences live in one module, read by the pull page, conflicts and the terminal (#5629) 0ec2145
- Sign-up's username and taken-email sentences live in one module, read by every way an account is made (#5608) 77acca0
- A new issue's and pull's length limits live in one module, read by both forms (#5605) e719cf6
- An admin's refusals (self-suspend, scorecard, front page) live in one module, and the API and MCP read them from there (#5576) 13a3b93
- Email verification's sentences live in one module, and the API and MCP read them from there (#5574) cc28f60
- Markdown table alignment is named in docs/design/areas/prose.md, and .ta-c and .ta-r leave §5d (#5572) ee05fb1
- Line numbers in the code view are named in docs/design/areas/lines.md, and .ln leaves §5d (#5571) a5967a9
- The toast is named in docs/design/areas/toast.md, and .toast-body leaves §5d (#5567) de8f22d
- Spacing and layout utilities are named in docs/design/areas/layout.md, and .mb, .mt, .stack, .stack-tight, .spacer, .grow, .narrow and .narrow-wide leave §5d (#5551) 49a50ca
- The scrolling table is named in docs/design/areas/table.md, and .table-scroll leaves §5d (#5549) 572337b
- Icons are a component in docs/design/areas/icons.md, and .ico, .ico-loader and .sprite leave §5d (#5546) 39df91c
- The menu's panel, title and separator are named in docs/design/areas/menu.md, and leave §5d (#5513) b569552
A spawn that would pass a declared child quota is now refused with a 409 refused and one sentence naming the limit. The New forge page shows that sentence above the form when even a small forge would not fit. The new quota tests and test/new-forge.test.ts pass unchanged (17 tests), and tsc --noEmit is clean. I did not run the full check or design-lint (the change adds no new component class).
- Quota:
FORGE_CHILD_CPUS,FORGE_CHILD_MEMORY_MIBandFORGE_CHILD_DISK_MIBdeclare what all children may hold together. A variable that is unset, zero or not a whole number declares nothing, so test hosts and today's forges behave as before. The logic is in the newsrc/spawn/quota.ts. It reads the env on every check, sums the sizes in the ledger (a ledger with no size counts as small), and names the first limit the new forge would pass. - Where it applies: the check runs in
make()insrc/actions/spawn.ts, only for a new child. Retrying or re-answering a child that already exists is never refused for quota. - New forge page: the sentence is a
#quota-fullstatus line above the form. The form still renders, sof-name-errandf-modelKey-errstill appear beside their fields. This is separate from the existing "cannot hold another child" screen, which still replaces the form when the child count is full. - Other changes: I added
"quota"to the placement refusal reasons insrc/spawn/placement.ts, and a "Child quota" section inREADME.md. - Tests:
test/child-quota.test.tscovers four cases:- Unset or invalid: nothing is refused and the page has no sentence.
- Set and full: the second spawn gets a 409 with the sentence, the page shows it, and a field error still renders.
- Per-size fit: a limit with room for small but not large refuses only large.
I did not add an AGENTS.md or CLAUDE.md note. Disk is counted from declared sizes, not measured usage.
Try it: start the forge with FORGE_CHILD_CPUS=1, spawn one child, then open /forges/new.
The terminal New forge screen and the New menu now say the quota sentence up front. Type check, design-lint and the focused tests pass (33 tests across the quota, web form and terminal screens); I did not run the full check.
- Terminal:
newForgeScreencallsquotaFull(dataDir)when it opens. If even a small forge would not fit, it draws "This forge cannot hold another child: …" on the first row and the fields below it. A tty test intest/tui-newforge-size.test.tschecks that the sentence and the Name field are both on screen before anything is typed. - New menu:
layout.tsnow usesnoRoom(...) ?? quotaFull(...)as the disabled reason, so New forge is greyed out with the quota sentence when the quota is full.test/child-quota.test.tschecks that the home page carries the sentence. - Web notice:
docs/DESIGN.mdnames no notice component for a standing sentence. I dropped the hand-rolledclass="error mb"and used a plain<p role="status" id="quota-full">, the same markup as the existing "cannot hold another child" line on that page. If you want a named component, say which one.
A spawn that would pass a declared child quota is now refused with a 409
refusedand one sentence naming the limit. The New forge page shows that sentence above the form when even a small forge would not fit. The new quota tests andtest/new-forge.test.tspass unchanged (17 tests), andtsc --noEmitis clean. I did not run the full check ordesign-lint(the change adds no new component class).FORGE_CHILD_CPUS,FORGE_CHILD_MEMORY_MIBandFORGE_CHILD_DISK_MIBdeclare what all children may hold together. A variable that is unset, zero or not a whole number declares nothing, so test hosts and today's forges behave as before. The logic is in the newsrc/spawn/quota.ts. It reads the env on every check, sums the sizes in the ledger (a ledger with no size counts as small), and names the first limit the new forge would pass.make()insrc/actions/spawn.ts, only for a new child. Retrying or re-answering a child that already exists is never refused for quota.#quota-fullstatus line above the form. The form still renders, sof-name-errandf-modelKey-errstill appear beside their fields. This is separate from the existing "cannot hold another child" screen, which still replaces the form when the child count is full."quota"to the placement refusal reasons insrc/spawn/placement.ts, and a "Child quota" section inREADME.md.test/child-quota.test.tscovers four cases:I did not add an
AGENTS.mdorCLAUDE.mdnote. Disk is counted from declared sizes, not measured usage.Try it: start the forge with
FORGE_CHILD_CPUS=1, spawn one child, then open/forges/new.Closes #2981