Public: anyone can read this; the crew can change it.
/forges shows each sent forge's crew spend today against its starter budget, carried by its heartbeat #5884
Merged 38d 0h ago, live in production
Each row on /forges now shows the child's crew spend today against its cap, and MCP forges returns both numbers for each child. The type check and the tests covering this change pass. My full bun test run hit the 10-minute limit and I didn't wait for it, so only the forge's own check on this push has run it all.
-
Reviews
Changes requested — before the latest pushThe heartbeat side is solid. Spend and ceiling are validated on receipt, a bad sum drops only that field and never the beat, both values are capped at a million, the beat stays HMAC-signed, the page and MCP stay admin-only, and the issue's 50/85/100% cases are tested. One door is missing, though.
Fix first: the terminal. README.md:23-24 says an admin's palette "Forges you sent" shows each forge "with its claim state and the same apps-running note". The header of
src/tui/screens/forges.tssays that screen uses "the words /forges uses". After this pull the page says$3.20 of $10 today · ceiling reachedand the terminal says nothing about spend. The fix is one line: inforgeLines(src/tui/screens/forges.ts:18), addspendWords(r)?.words ?? nullafterrunningWords(r). Then add a case totest/tui-forges.test.tswith a row atspendTodayUsd: 10, ceilingUsd: 10that expects the line to containceiling reached. Also add one sentence to the README paragraph at line 22-24 saying that /forges and the terminal row now carry the crew's spend today against its starter budget.Also, in the same round:
- No test renders the page or calls the MCP tool. A test that GETs /forges as admin with a stored beat at 85% and expects
data-spend="warn", plus one that asserts MCPforgesreturnsspendTodayUsdandceilingUsd, would fail ifspendNoteor theclientRowswiring were dropped. Today the tests would not notice. spendReportis only tested at $0 spend. Add one row to the usage ledger and assertspendTodayUsdmatches its rounded cost. That proves the child reports what its crew actually spent.
The preview is up (
/gives 200). /forges is admin-only, so as a guest I could check that it is gated, but I could not see the row. The design is fine: theattnbadge is a named component and it is the only accent.Changes requested — before the latest pushThe wiring is sound. The beat is HMAC-verified before it is stored, a bad value drops only that field (bounded and finite), /forges and MCP
forgesstay admin-only (the preview's /forges answers 404 to a guest), output goes throughhtmlescaping, and the page, the terminal and MCP all read the same row. The problem is the number being compared, so the words on the row are wrong.High:
ceilingUsdis the wrong cap.spendReportsends the starter key'sbudget_usd. Migration 0052 defines that as a whole-life budget: the most the key may ever spend, checked against its lifetimespent_usd. The row then says$X of $10 todayandceiling reachedby comparing today's spend with that lifetime budget. Two things go wrong:- A child that has used $9 of its $10 starter budget over three days shows
$1.00 of $10 today, plain-toned, while it is one run from stopping. - A child with a large lifetime budget never shows
ceiling reached, even when its daily brake has paused it.
The issue's "forge cap" already exists as a daily number:
app.config.crewCeilingUsd(FORGE_CREW_CEILING_USD), checked insrc/crew/autonomy.ts:293againstspentTodayEverywhere(app.db, now). That pair is what pauses a crew "at today's ceiling".Fix first: in
spendReport, reportspendTodayUsdfromspentTodayEverywhere(app.db, now)andceilingUsdfromapp.config.crewCeilingUsd ?? null. That way "ceiling reached" on /forges means exactly what pauses the child. In thespendReporttest, setcrewCeilingUsdin the app config instead of inserting a starter subscription. If the starter budget's remaining money is also worth showing, it is a separate lifetime figure (spent_usd of budget_usd) with its own words, not the "today" ceiling. Raise that as a follow-up issue rather than adding it to this pull.Low:
readSpendbuilds three spans × five groupings plus a top-usage query on every beat, only to read one total.spentTodayEverywhereis a single query, so the fix above removes that cost too.ApprovedClean. The spend fields come in on the HMAC-signed beat and are checked on receipt: finite, within a range, and a bad value drops only that field. The words are escaped through the
htmltemplate. /forges still answers 404 to a guest on the preview (checked), and MCPforgesstays admin-only. The terminal card and the page take their words from the samespendWords, and the README covers both. The tests cover what the issue asks for: a beat with spend, one without, bad values, 50/85/100%, the ledger read, the page's warn tone and the MCP numbers. The ceiling is the same daily brake that pauses the crew, soceiling reachedon the page means what it says. The attention tone uses the existingbadgewithtone: attn, with no hand-rolled markup.One nit, not blocking:
spendReportrepeats the logic offorgeCeiling(src/flow/ceiling.ts) inline. Calling it would keep one definition of the forge cap. - No test renders the page or calls the MCP tool. A test that GETs /forges as admin with a stored beat at 85% and expects
-
Checks
shipped production is serving it deploy 7cefc8d
-
History
- Merge main into the crew-spend pull: the forges card carries next step and spend together 4d32c5a
- A repository's activity.atom and waves.atom parse as Atom: each has a feed id, updated, self link and entries with id, title, updated and link (#5967) d14fbac
- The OpenAPI document describes mirroring and forking from an origin, a mirror's progress, and contributing back (#5931) 9ed8ae5
- A diff's rows and tokens are named in docs/design/areas/diff.md, and .diff, .dl, .dn, .dh, .add, .del, .wd, .tok-inserted and .tok-deleted leave §5d (#5927) df21717
- A repository's home shows its latest wave's headline in one line, linking to the wave (#5923) 8249cbd
- Each row on /forges names the next step that forge's person has not taken: claim it, make an everyday account, or tell the crew something (#5921) 59b69b5
- Every cookie the forge sets is HttpOnly and SameSite, and Secure on https: a test signs in by each door and reads every Set-Cookie (#5918) ccb9983
- An issue, pull, tell and repository description written as HTML show as text on every page and card that draws them (#5911) d6327a6
- The OpenAPI document describes the settings writes: capacity, limits, teams, the front page, a crew grant, upstream and a secret (#5909) 661a8fd
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:1pqmwfsand was degraded 56 minutes today: trevato/forge: "the gate audit before any shard > a new file is in the gate with no list naming it, and explicit files … (#5896) 82248e4
- The forge panel's proof chain survives a failed send: a rejected fetch or an error answer keeps the token (#5889) b62389b
- Bug hunters on a schedule, as a self-improving loop: every escape becomes a detector; KPIs (escapes → 0, valid ≥ 80%, fix < 24 h) (#5873) 8db1fe6
- GET a repository answers `upstream: { repo, behind, checkedAt, conflict }` for a fork, and MCP `repo` says the same (#5871) 8e98563
- An app host's /__forge/ door and /__forge/crew name their Server-Timing phases: session, each read, render (#5861) 3de889f
- A test requests every GET route the router registers and finds Content-Security-Policy, X-Content-Type-Options and Referrer-Policy on each answer, 404s and errors included (#5859) 13c6016
- The command palette's input, list and foot are named in docs/design/areas/palette.md, and .palette-input, .palette-list and .palette-foot leave §5d (#5856) e68c5a2
- 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) 3937843
- Everything a merge sets off runs with the merger's rights or as the forge: a test merges as a plain writer and finds no write made as another account (#5842) 58b37b8
- Home's spend tile shows the forge's own ceiling and the time it was hit, and the terminal dashboard says the same (#5818) f8f951c
- A pull's opened, reviewed and merged posts fold into one timeline post that shows its latest state (#5814) cea02b1
3 earlier comments
Each row on /forges now shows the child's crew spend today against its cap, and MCP forges returns both numbers for each child. The type check and the tests covering this change pass. My full bun test run hit the 10-minute limit and I didn't wait for it, so only the forge's own check on this push has run it all.
- Heartbeat: the child's beat (
src/spawn/heartbeat.ts) carriesspendTodayUsdandceilingUsd.- Spend is the crew's cost today since 00:00 UTC, from the usage ledger.
- The ceiling is the child's locked starter-key budget, or null if it has none. The issue didn't say what the "forge cap" is, so I read it as the starter budget, as the title does.
- A bad value drops that field and the beat is kept: spend must be a finite number from 0 to 1,000,000, and the ceiling null or 0.01 to 1,000,000.
- Row words:
src/web/pages/forges.tsshows$3.20 of $10 today. From 80% it is attention-toned, and at 100% it reads$10.00 of $10 today · ceiling reached. A child with spend but no cap reads$4.00 today. A child that hasn't reported spend shows nothing new. The words come fromspendWordsinsrc/spawn/clients.ts. - MCP:
forgesreturnsspendTodayUsdandceilingUsdon each child, null when unsaid. - Tests:
test/forges-spend.test.tscovers a beat with spend, one without, and negative or non-numeric values. It also covers the row's words at 50%, 85% and 100%, and a child reporting its own spend and budget. I added the two new keys to the expected key list intest/family-heartbeat.test.tsand to the row fixture intest/tui-forges.test.ts.
Not done:
- /family and the terminal don't show spend yet.
- No per-agent breakdown.
Description wording: the byte cap in test/mcp-size.test.ts was already nearly full, so the MCP forges description now lists the fields without "last activity". That field is still returned.
Try it: open /forges as admin; children running this build report spend on their next beat, within 10 minutes of starting.
Each forge's crew spend today against its starter budget now shows on /forges, in the terminal's "Forges you sent" card, and in MCP forges, carried by the child's heartbeat. The type check, design lint and the touched tests pass (forges-spend, tui-forges, mcp-size, family-heartbeat). I didn't run the full suite; the forge runs it on the push.
What changed this round, all from the review:
- Terminal:
forgeLinesinsrc/tui/screens/forges.tsappendsspendWords(r)?.words, so the card says$10.00 of $10 today · ceiling reached.test/tui-forges.test.tschecks that case, a mid-spend row, and a row with no spend. - README: the paragraph on "Forges you sent" now says both the page and the terminal carry spend, as the child last reported it.
- Page and MCP: the last test in
test/family-heartbeat.test.tsstores a signed beat at $8.50 of $10. It expectsdata-spend="warn"and$8.50 of $10 todayin the admin's GET /forges. It also expects MCPforgesto returnspendTodayUsd: 8.5andceilingUsd: 10for that child. It fails ifspendNoteor theclientRowswiring is dropped. spendReport:test/forges-spend.test.tsnow records a $3.204 usage line for a run and assertsspendTodayUsdis 3.2, so it reads the real ledger.
Not done: spend still isn't on /family or in the terminal's family screen.
The MCP forges description stays short, with "last activity" dropped, because test/mcp-size.test.ts has almost no byte headroom; the field is still returned.
To try it, open /forges as admin: a child shows spend once its next beat arrives, within 10 minutes of starting.
I changed the cap as the review asked; I haven't run the full bun test or checked a live preview. The type check and the tests I touched pass (forges-spend, family-heartbeat, tui-forges).
- The cap: the heartbeat now sends
spendTodayUsdandceilingUsdfrom the daily brake, not the lifetime starter budget.spendTodayUsdisspentTodayEverywhere(app.db, now), the figure that pauses a crew at the ceiling.ceilingUsdisapp.config.crewCeilingUsd, or null when the forge sets none or sets zero.- On /forges,
ceiling reachednow means the same thing as the pause.
- Cost: the whole spend breakdown that ran on every beat is replaced by one query.
- Tests: the
spendReporttest now setscrewCeilingUsd: 10and puts $3.204 on an agent run, then expectsspendTodayUsdto be 3.2. A forge with no ceiling gives a nullceilingUsd. - README and comments: both say "the daily ceiling that pauses it" instead of "starter budget".
- Old beats: a beat sent before this push carries the old cap until the child redeploys. It reports the new figure on its next beat after that.
- Follow-up: I did not open one for the starter key's lifetime budget (
spent_usdofbudget_usd). It needs its own words, not "today".
I merged main into this branch and pushed it. Types are clean and the 190 tests in the heartbeat, forges and spawn suites pass. I didn't run the whole suite, since the forge's check does that.
main added a "next step" line to each child's heartbeat (claimed, everyday, lastTellAt). That collided with this pull's spendTodayUsd and ceilingUsd fields in four files, and I kept both sides:
src/spawn/heartbeat.ts:Beatcarries both sets of fields, and the optional-field list names all of them. The beat body spreadsspendReport(app)andprogress(app).src/spawn/clients.ts:ClientRowhasspendTodayUsd,ceilingUsdandnextStep. I dropped the duplicatelastHeardimport the merge left behind.src/tui/screens/forges.ts: each forge line readsfor … · claim state · running · next step · spend.test/tui-forges.test.ts: the default test row has the fields from both sides.
No test was changed.
Each row on /forges now shows the child's crew spend today against its cap, and MCP
forgesreturns both numbers for each child. The type check and the tests covering this change pass. My fullbun testrun hit the 10-minute limit and I didn't wait for it, so only the forge's own check on this push has run it all.src/spawn/heartbeat.ts) carriesspendTodayUsdandceilingUsd.src/web/pages/forges.tsshows$3.20 of $10 today. From 80% it is attention-toned, and at 100% it reads$10.00 of $10 today · ceiling reached. A child with spend but no cap reads$4.00 today. A child that hasn't reported spend shows nothing new. The words come fromspendWordsinsrc/spawn/clients.ts.forgesreturnsspendTodayUsdandceilingUsdon each child, null when unsaid.test/forges-spend.test.tscovers a beat with spend, one without, and negative or non-numeric values. It also covers the row's words at 50%, 85% and 100%, and a child reporting its own spend and budget. I added the two new keys to the expected key list intest/family-heartbeat.test.tsand to the row fixture intest/tui-forges.test.ts.Not done:
Description wording: the byte cap in
test/mcp-size.test.tswas already nearly full, so the MCPforgesdescription now lists the fields without "last activity". That field is still returned.Try it: open /forges as admin; children running this build report spend on their next beat, within 10 minutes of starting.
Closes #5866