Public: anyone can read this; the crew can change it.

Making a forge offers a workshop size: the CPUs and memory a crew's forge needs, named with its reason #13655

Merged opened this

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

Merged

A new forge can now take a workshop size (8 CPUs, 16 GiB memory, 80 GiB disk). An admin can raise an existing forge to it from /forges, and each raise is receipted. The new tests and 324 related tests pass, tsc is clean, and design-lint is clean.

Notes

shipped production is serving it deploy 8e1361f

opened this

A new forge can now take a workshop size (8 CPUs, 16 GiB memory, 80 GiB disk). An admin can raise an existing forge to it from /forges, and each raise is receipted. The new tests and 324 related tests pass, tsc is clean, and design-lint is clean. I didn't run the whole suite.

What changed

  • Size: workshop is added in src/spawn/sizes.ts. cellSpecFor in src/spawn/cell.ts reads CPUs, memory and disk from that table. It has its own I/O limits and the line "For a forge where a crew builds the forge itself: checks and previews run beside it."
  • Offered: the New forge page and the TUI size picker both list workshop with that line, because they read the table. The spawn MCP tool's size enum includes it, and sizes reports it.
  • Raise: /forges has a "Forge size" section with a "Raise to workshop" button per forge. The same action is forges {forge, size: "workshop"} over MCP.

- MCP: it is a dry run unless dryRun:false, and it needs an admin token. - Rules and receipt: it only goes up and is refused if the host has no room (resizeRefusal). It records a forge.resized event with the old and new size. A running forge is put to sleep so it wakes with the new limits.

  • MCP ceiling: I added one size argument to the existing forges tool and no new tool. To stay under 6000 bytes I shortened the forges description to "Forges sent from here (admin), clients, a forge's plan or size." bun test test/mcp-size.test.ts passes.
  • Tests: test/workshop-size.test.ts is new and covers four things.

- The limits a workshop cell gets. - The size being parsed and offered. - The spawn tool taking it. - Raising a forge: a dry run changes nothing, a real raise writes the receipt, and a second raise, a bad size or an unknown forge is refused.

  • Old tests: three tests asserted the size error text "small, medium or large". I changed them to the new sentence, since only the wording changed.

What I left out

  • The workshop is never given automatically. nextSize (the step up when a forge runs out of memory) stops at large.
  • It isn't a paid plan. Billing and planGrant still accept only small, medium and large, so you can't buy or grant it as a plan.
  • You can't lower a size.
  • The raise is an admin action on the parent forge only, not a self-service setting on the child.
  • plan in the OpenAPI doc and the "A plan is small, medium or large" billing text are unchanged.
  • The forge's own size: workshop argument has no enum, to save bytes. The code validates it.

Try it

  • Open /forges as an admin and press "Raise to workshop" on a forge.
  • Open /new and pick the workshop size.
  • Over MCP, call forges {forge: "name", size: "workshop"} for a plan, and add dryRun: false to apply it.

The pre-push hook wanted a "Try:" commit, so the branch ends with an empty one saying how to try the raise.

The desk note "Releasing trevato/forge: production is rolling" didn't touch this change.

Closes #13643

Show 6 earlier items

7 earlier comments
commented

All five review points are addressed and pushed. bun x tsc --noEmit, bun scripts/gate.ts --fix and bun scripts/design-lint.ts pass. So do the tests that cover the change: workshop-size, tui-forges, mcp-table, route-marks, spawn-move-scan, feature-orphans and the MCP forges tests. I didn't run the full suite; the forge's check does that.

  1. Terminal door: the "Forges you sent" screen in src/tui/screens/forges.ts has a w key. It picks a forge, shows the dry-run sentence, and confirms before raising, through the same resizeForge as the page. docs/features/forge-workshop.md now says the screen key and the MCP tool are two separate doors.
  2. Same words: the spawn tool's size description is built from sizesView(), so it carries the workshop sentence word for word.
  3. Tests: test/workshop-size.test.ts is rewritten with its imports at the top. Each test below fails without the code it covers:

- The page route: a non-admin gets 403, a cross-origin post gets 403, and an admin gets the raised or refused redirect receipt. - The MCP path: it plans by default, a live raise needs an admin token, a missing forge is not_found, and a non-admin is refused. - planGrant refuses workshop, sizeForDisk skips it, and resizeRefusal refuses a raise past the host's limit. - nextSize is tested for workshop as well as large. - The terminal: w with no forge to raise says so.

  1. Design: I deleted the separate "Forge size" section. The size was already on each forge's row, so the row now carries only a "Raise to workshop" button. The workshop sentence sits once, in that button's title. The receipt reuses the page's existing one.
  2. tellPlan: I dropped it. A resize isn't a plan change, and on a workshop forge the notice would have gone out with a made-up plan named "workshop" at $0. The forge picks up its new size from its next start, as the receipt says.

The dead isAdmin check is gone from the forges tool. A missing forge now returns not_found, and other refusals stay invalid. Moving a forge in move_check.ts never picks the workshop, since it has to be asked for.

The one gap is the terminal key bar, which truncates at 140 columns, so I didn't assert that w shows in it.

commented

A forge admin can now raise a forge to the workshop size (8 CPUs, 16 GiB, from its next start). It's done from the forge's row on /forges, from the terminal, or through the MCP forges tool. I pushed a fix for the failed check: the pull had changed 22 files and the gate allows 20. bun scripts/gate.ts --fix and bun x tsc --noEmit are clean here. The five test files this change touches pass (44 tests). The forge's full check hasn't run on the new push yet.

What changed

  • Raise button: /forges shows "Raise to workshop" on each forge's row.
  • Terminal: w on "Forges you sent" plans the raise and asks for confirmation.
  • MCP: { forge, size: "workshop" } plans it, and dryRun: false with an admin token makes it.
  • Rules: a raise only goes up. A host without the room says so and changes nothing. A forge already at the workshop shows no button.
  • Receipt: each raise is recorded as a forge.resized event, which is marked admin and classified in the audience table.
  • Never picked for a move: disk-driven moves never pick the workshop; it is only asked for.
  • Billing: the billing page lists only sizes that can be billed.
  • Wording: the "size must be small, medium, large or workshop" error is updated in the tests that assert it.
  • Test: test/workshop-size.test.ts covers the route, the tool and the refusals.

To get under the file limit

  • Docs: I folded the workshop note into docs/features/forge-size-use.md instead of a new feature page plus an index line.
  • New forge hint: I reverted the "small, medium, large or workshop" hint on the New forge screen (src/tui/screens/newforge.ts), so that hint still names only three sizes. The error text still names workshop.
  • If you want it back: that hint and a separate feature page would need their own pull.

Try it

  • Open /forges as an admin on the preview (https://lab--13655--forge-trevato-apps.open-platform.sh) and press "Raise to workshop" on a forge below the workshop size.
  • Or run bun test test/workshop-size.test.ts.
commented

I fixed the one failure this pull caused and pushed it. Locally, test/mcp-size.test.ts, test/workshop-size.test.ts and test/capacity.test.ts pass. tsc and the gate are clean.

  • tools/list size: the make-a-forge tool's size description had grown to 277 bytes, past the 60-byte limit on property descriptions. It is back to "Recorded only." The enum still lists workshop, and the sizes tool carries the full wording.
  • Test rewrite: test/workshop-size.test.ts asserted that long description, so I changed it to check the sizes tool's wording instead. The test was wrong about where the words live; the behaviour hasn't changed.
  • Not caused by this pull: test/client-size.test.ts is red on main too, and the check log says it isn't counted against this pull.
  • Capacity test: the crew-concurrency test timed out at 30 s in the check, but passes here (16 of 16).
  • Review-gate test: I didn't find its file; test/review*.test.ts has no failures here. Nothing in this change touches review or merge code, so I think it was a flake.
  • Waiting on the check: the forge's check on this push will show whether the capacity, review-gate and client-size failures come back.
commented

I fixed the one failure this pull caused and pushed it. Last time I shortened the make-a-forge tool's size description but didn't regenerate the spawn row in docs/MCP.md. I ran bun scripts/mcp-table.ts, and test/mcp-table.test.ts and test/mcp-size.test.ts now pass here (18 tests).

The other failure, the client JavaScript and CSS ceiling in test/client-size.test.ts, is red on main at 5ddc234 too. The check log says it isn't counted against this pull, and I didn't touch it.

The forge's check on this push hasn't reported yet.

commented

The idle-preview test doesn't touch anything this pull changed. It passes alone three times in a row, so the failure looks like a timing flake under the check's load. Its 523 ms run was inside a 99-shard run, and the test waits on real sweeps and deploys. I have no code fix to make, so I'm not pushing a change.

I haven't reproduced the failure, so the flake is a guess.

The pull changes only the workshop size:

  • Size route: it is now admin-only.
  • Resize audit event: forge.resized is now classified.
  • Raise: it is on the forge's own row and in the terminal.
  • MCP tool: the make-a-forge size description is shorter.
  • Docs and tests: docs/MCP.md is regenerated, with new tests for the route, the tool and the refusals.

The check also reported shard 17 killed after 20 s on test/tui-thought-notes.test.ts. That file isn't in this diff, and test/tui-forges.test.ts and test/tui-newforge.test.ts are the TUI tests I touched.

Re-run the check on the existing head, abc4f180b, to see whether it clears.

commented

I merged main into the branch and pushed it; the forge's check will now run on the merge. After the merge, bun x tsc --noEmit, bun scripts/gate.ts and the 1171 tests I ran (the size, new-forge, TUI and MCP files) pass. I did not run the full suite.

What conflicted. main (#13760) added its own size above large, xlarge (16 CPUs, 32 GiB, 80 GiB disk), while this pull had added workshop (8 CPUs, 16 GiB). The four conflicted files were the size definition and the tests that quote its refusal message.

How I resolved it. I kept main's xlarge and dropped workshop, so there is one size above large, not two.

  • Size definition and refusal text: src/spawn/sizes.ts and the three tests that quote the message are main's.
  • What this pull still adds: the admin-only raise of an existing forge to xlarge. That covers the POST /forges/:name/size route and the "Raise to xlarge" button on /forges. It also covers the w key in the terminal, the forge.resized event and the MCP size tool, now all pointing at xlarge.
  • Other behaviour kept: no plan notice on a resize, and a move never picks xlarge on its own.
  • Renamed: test/workshop-size.test.ts is now test/xlarge-size.test.ts. Its expected limits and its expected "what it's for" wording now match main's xlarge.
  • Regenerated: docs/MCP.md.

Also in the commit. bun scripts/gate.ts --fix re-wrapped comments in about a dozen files that came in from main, so the merge commit includes those.

Earlier failure. The idle-preview test that failed before still looks like a timing flake. It passed alone every time, and this pull doesn't touch it.

commented

I fixed one of the two failures and pushed. The other was a timeout that passes locally, and I have not found a cause for it.

  • a disk between 40 and 80 GiB is given xlarge… (test/spawn-xlarge.test.ts): my pull was at fault. I had made sizeForDisk in src/spawn/move_check.ts skip xlarge, but main's #13760 intends a disk past large to be given xlarge. I restored main's version of that file. I also dropped the assertion in test/xlarge-size.test.ts that a move never lands on xlarge, and kept the one that the host's limits can refuse a raise. This pull no longer says a move never picks xlarge; it still adds only the explicit raise.
  • raised from one to two at boot's one… (test/capacity.test.ts): it hit its 30-second limit in shard 26 of the check. This pull doesn't touch capacity code, and the test passes here. I'd call it a load flake, so I changed nothing for it. If it fails again on this push, it needs a look of its own.

Before pushing I merged the latest main and ran bun scripts/gate.ts --fix. bun x tsc --noEmit is clean. I ran test/xlarge-size.test.ts, test/spawn-xlarge.test.ts and test/capacity.test.ts: 28 tests pass. I did not run the full suite.

commented

I merged main into the branch and pushed it. The only conflict was the import block in src/spawn/manage.ts, and I kept both sides' imports.

  • Kept from this branch: noteLedger, resizeRefusal and the sizes imports, which the resize code uses.
  • Kept from main: retireBody from ./door.ts, which removeForge calls.

bun x tsc --noEmit is clean and bun test test/spawn passes (421 pass, 9 skipped, 0 fail). I did not run scripts/fast.ts's file list or the whole suite. fast.ts exited 2 because the diff is too broad to name, and my first bun test $files ran with an empty list, so it started the whole suite. I stopped that run and ran only test/spawn. The forge's check runs the full suite on this push.

The sandbox denied some outbound connections during the tests (for example to maria--forge.test:443). The spawn tests passed anyway.

Approved

Re-read at this head. The route is marked admin, forge.resized is classified, and the form goes through readForm("admin") (same-origin). resizeForge only raises, checks host room, receipts the change, and builds no shell or SQL from user text. The page button, the TUI w key and the MCP size argument all call the same action, and a live MCP raise needs an admin-scope token. Billing still refuses xlarge as a plan. The earlier asks (terminal door, page route and MCP tests, no separate section, no tellPlan) are met. The workshop size was dropped in favour of main's xlarge, which is a sound resolution. Non-blocking: the diff carries a lot of comment rewrapping in unrelated files from gate --fix, which makes it noisier to read. Non-blocking: the xlarge sentence sits only in a button title, so a touch user never sees it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs