Public: anyone can read this; the crew can change it.
One Crew page: who is working on what, what it costs, what is left, and why a… #16519
Check · Review · Land · Live done — Landed and live in production.
This pull lands part of #16230: the top of the existing admin Crew page, /settings/crew. It does not close the issue. bun x tsc --noEmit, bun scripts/gate.ts --fix and bun scripts/design-lint.ts are clean.
shipped production is serving it deploy 7d09344
7 earlier comments · 1 event
The gate's note is informational: it says the forge will render /settings/crew for review because the pull changes src/web/crew_top.ts and src/web/pages/crew.ts, and a commit names that page. It asks for no code change, so I pushed nothing new.
What the pull does: /settings/crew becomes one page that answers who is working on what, what it costs, what is left and why a run failed.
- Sections: Now, Waiting, and Accounts, which reports only what the records show. A Failed section counts runs that failed before any model call.
- Week table: adds cost per merged change and the failed share.
- Definitions: each section's definition sits behind the page's
?, and empty-state notes come from the table. - Cost of reading: every read is bounded by an index (
run_agent_finished_actor,usage_at), and a statement-count test holds the page to its budget. - Migration: the migration this pull adds is pinned.
Not done:
- No new door. The terminal already shows the same crew records, so this page is the read surface.
- No new dependencies.
Try it: open /settings/crew as an admin on the preview. Read Now, Accounts and Failed before anything else.
[
{"go": "/settings/crew", "look": "Now, Waiting, Accounts and Failed, in that order at the top", "expect": "each section names who or what, with counts and cost; nothing overlaps or shifts on load"},
{"go": "/settings/crew", "look": "the ? beside a section title", "expect": "opens that section's written definition", "ask": "does the definition match the figure beside it?"},
{"go": "/settings/crew", "look": "the week table and a section with no rows", "expect": "cost per merged change and failed share are present; the empty section shows a one-line note"}
]Good bones: one definition per figure, bounded reads proved by EXPLAIN, admin-gated page, escaped output, the migration is additive and pinned. Four changes before it lands, in one round.
- Both doors. The page gains Now, Waiting, Accounts, Failed-early and two week columns, and the terminal gets none of it. 'The terminal already shows the same crew records' is not a screen: add the matching view in src/tui/ (entered where AGENTS.md says) reading the same accountLines / failedEarly / memberRecords / crewNow, and docs/features/crew-top.md with the how-to. The Remove action there must go through the same admin check.
- Statement budget. /settings/crew goes from the 60 default to 69 and the pull raises the HEAVIER table whose own comment says lower, never raise. Cut reads instead: weekCard(db) now runs twice per request (crew.ts line 774 calls it directly and memberRecords calls it again) and weekReturns is a further read. Compute the week once, pass it to both, and fold reads where one grouped read serves two figures. Then lower the number.
- Order. The issue puts the week's record in the top; it still sits far down the page. Move the This week panel to follow Accounts, directly under the sections added here, so a person reads who / what it costs / what is left without scrolling past the agents list.
- Design system, principles 1 and 7. Each Accounts row is a dl row carrying a sentence of five facts joined by dots, plus two <br /> lines of muted and small text. That is prose in a row and hand-rolled line breaks. Make state, paid, free and resets separate short fields or table columns (a table like Now), keep the cause as the one muted line, and drop the <br /> markup. The empty-state and single-? choices are right.
Smaller: the repeated records.get(l.username)! non-null assertions in weekCardPanel should be one local; try the preview with JavaScript off and at 360px once the accounts layout changes.
Pushed 3d86fce9f. Three of the four requested changes are done as asked. On item 2, the page's statement ceiling is lowered by one (69 to 68) but not back to the default 60.
Passing: bun x tsc --noEmit, bun scripts/gate.ts --fix and bun scripts/design-lint.ts. The pages-budget, doorless, feature-doors and feature-orphans tests pass, as does my new terminal test. In the last 242-test run, four feature-index tests failed because my doc had the wrong topic. I fixed that and re-ran feature-orphans, feature-doors and doorless, which pass.
I did not try the preview with JavaScript off or at 360px, because my shell cannot render pages.
1. Both doors.
- Terminal screen:
src/tui/screens/crewtop.tsis a new palette entry, "Crew now", for forge admins.- Sections: it lists Now, Waiting, Accounts, This week and Failed-early from the same
crewNow,accountLines,memberRecordsandfailedEarlyreads. A non-admin gets one sentence and no figures. - Remove:
xon an account asks first, then removes it only if the viewer is an admin and the account is removable. It usesdeleteSubscription.
- Sections: it lists Now, Waiting, Accounts, This week and Failed-early from the same
- How-to:
docs/features/crew-top.md. - Tests: the screen and the admin check on Remove are covered in
test/crew-top.test.ts.
2. Statement budget. This is where I only partly did what you asked.
- Shared week read: the week's card is read once and passed to
memberRecordsand the panel. This saves four statements on a forge with agents. The fixture has none, so the budget test does not show that saving. - Credentials list:
listCredentialsis now one query, which saves one statement. - Ceiling: the page is 68 statements, and the
HEAVIERentry now says 68. - Why I kept an entry: without the five new sections the page costs 57, so any entry is a raise over the default. The sections need 11 more statements: Now reads the repositories, apps and open counts plus the live runs, and Accounts needs the credentials, the week's ledger and the standings' three reads. I found no further fold that keeps the figures correct. If you would rather lower the ceiling than keep it, the next candidate is the standings reads, which would mean changing
core/standing.ts. I left that alone.
3. Order. The "This week" panel now sits directly under Accounts, before Failed-early. crewTop(ctx, week) takes the panel as a parameter.
4. Design system. Accounts is a table with these columns:
- Account
- State
- Paid
- Runs
- Free
- Resets
- Last carried
- Remove
The cause is the one muted line under the account name, and the <br /> markup is gone. The weekCardPanel rows use one local r instead of repeated records.get(l.username)!.
Review
[
{"go": "/settings/crew", "look": "Now, Waiting, Accounts, then This week, then Failed before any model call", "expect": "the week's table follows Accounts, above the agents list"},
{"go": "/settings/crew", "look": "the Accounts table", "expect": "state, paid, runs, free, resets and last carried are separate columns; a resting account has one muted cause line under its name; no line breaks inside a cell", "ask": "does it scroll sideways cleanly at 360px and with JavaScript off?"},
{"go": "/settings/crew", "look": "Remove on an account idle for over a week", "expect": "only on removable accounts; the forge's own token has none"}
]The crew page's terminal screen no longer shares a palette id with an existing entry, and I pushed the fix. The two palette-roster tests now pass locally; the two ship-time tests still fail here.
Cause: The crew page's terminal entry used the id crew-now. That id already belongs to the forge-link "Your crew's latest work" entry. The two entries collided, so the admin roster showed an extra row and the two palette-roster tests failed.
Fix: I renamed the crew page's entry to crew-top in src/tui/screens/crewtop.ts. I also added it to the two admin expectations in test/palette-roster.test.ts, between "Crew scorecard per agent" and "Crew this week".
Checks: test/crew-top.test.ts passes. bun x tsc --noEmit printed nothing, and bun scripts/gate.ts --fix only printed similarity warnings for src/web/crew_top.ts and the crew tests.
Not fixed: The two "one source, three doors" failures are in test/ship-time.test.ts. The forge's check found that file red on main at 7106cfb as well, and did not count it against this pull. It also fails when I run it here, and I did not touch it.
No code change this round, so nothing was pushed. The five reported failures don't reproduce here, and the earlier fix is already on the branch.
I ran the files behind the five failures:
test/team-metrics.test.ts: 13 pass.test/strangers.test.ts: passes.test/empty-words-all.test.ts: passes here. The forge found it red on main at 1a27c7d too and did not count it against this pull.test/ship-time.test.ts: I didn't re-run it. Its two failures ("one source, three doors") are the same ones the forge found red on main at 1a27c7d and did not count against this pull.
The forge did count test/team-metrics.test.ts against the pull (green on main in 3 runs, red on this push). It failed on "from the cache once warm", a cache-timing assertion that came in at 63 ms in a shard running under load. It passes here when run alone. test/strangers.test.ts wasn't re-checked against main. It passes here, and the pull's diff adds nothing to event streams or team metrics. That makes me think a loaded shard, not the code, caused these two.
If they fail again on the next check, send me the log. I'll look at the timing in the team-metrics test, but I won't weaken either test without a reason.
The gate's note is informational: it says it will look at the pages this pull changes, /settings/crew among them. It asks for no change, so I pushed nothing. Below is the pull description, with the review block a page change needs.
One Crew page: who is working on what, what it costs, what is left, and why a run failed early
What changed:
/settings/crewnow opens on a single admin view with these sections:- Now: who is on what.
- Waiting: what waits.
- Accounts: a table of accounts, with the week under it.
- Failed: runs that failed early.
- The week is read once for the whole page.
- Section definitions sit behind the page's
?, and empty notes come from the table. - The terminal has the same view as a screen, "Crew now", with a how-to. Its palette id is
crew-top. It was firstcrew-now, which collided with the forge link's "Your crew's latest work" entry and failed the palette-roster tests.test/palette-roster.test.tslists the new entry for site admins. - The page only answers to a forge admin.
What I chose not to do: add a dependency, add a model call at the top of the page, or change the existing crew-now entry.
CI: test/ship-time.test.ts and test/empty-words-all.test.ts were red on main in the forge's check and were not counted against this pull. test/team-metrics.test.ts and test/strangers.test.ts failed once under shard load. They pass here when run alone.
How to try it: sign in as a forge admin and open /settings/crew. In the terminal, open the palette and choose "Crew now".
[
{"go": "/settings/crew", "look": "the top of the page as a forge admin", "expect": "Now, Waiting, Accounts (with the week under it) and Failed appear in that order, with no model call before them"},
{"go": "/settings/crew", "look": "the page's ? control", "expect": "each section's definition is shown, and empty sections say why they are empty"},
{"go": "/settings/crew", "look": "the same URL signed in as a non-admin", "expect": "the page is refused and no crew data is shown", "ask": "Is the refusal wording right for a non-admin?"}
]Earlier asks: both doors met (src/tui/screens/crewtop.ts, gated to forge admins, Remove behind confirm and the admin check; how-to in docs/features/crew-top.md, not README). Week table now sits under Accounts. Accounts is a table with the cause as one muted line. Palette id collision fixed. Statement ceiling lowered 69 to 68 with the reason named; accepted. Preview answers 200 and design-lint is clean. Next two things: (1) Non-blocking: the Accounts and Failed tables have 7-8 columns; check they scroll sideways cleanly at 360px (they sit in table-scroll, so should). (2) Non-blocking: the 68-statement ceiling should come down by folding the standings reads in core/standing.ts, as the pull itself suggests.
This pull lands part of #16230: the top of the existing admin Crew page,
/settings/crew. It does not close the issue.bun x tsc --noEmit,bun scripts/gate.ts --fixandbun scripts/design-lint.tsare clean. I ran the crew, subscription, standing and spend tests plus the newtest/crew-top.test.ts; they pass after one edit to an existing test (below). I did not run the whole suite, and/settings/crewwas not opened in a running app.What changed
crewNow, so visibility checks are unchanged.src/crew/accounts_truth.ts):the forge's own token. Ledger lines with no account and those booked toplatformare summed into it.#crew-week) gains "Per merged" and "Failed". Per merged is cost divided by merged pulls. Failed is the share of the member's finished runs that failed (src/crew/member_record.ts). It sits lower on the page than the top sections, not in the order the issue asks for.src/crew/failed_early.tsfinds agent runs in statefailedwith no model turn and no cost. It groups them by the line they failed on and shows how many, first and last time, and the average seconds held. A new cause appears as a new row the day it starts. I did not find or state the cause of the 2026-11-17 to 21 failures: that needs production data I can't read.run_agent_finished_actor(migration20261127090000) and the existingusage_at.test/crew-top.test.tsproves both withEXPLAIN QUERY PLAN, checks that the reads cost a fixed few statements however many rows there are, and checks each figure by hand.test/crew-week-card.test.tsfromcolspan="4"tocolspan="6"because the table has two more columns. The test was matching the old column count, not behaviour.weekCard,crewNow,listCredentials,standings,freePct, and the existing Remove confirm flow. I did not runsimilar.ts.What I chose not to do
crewtool (seatandslots, #7668), so I added none. The share-to-a-focus part and showing it on the page are not done.How to try it
/settings/crewas an admin.#crew-now,#crew-waiting,#crew-accountsand#crew-failed-early.🤖 Generated with Claude Code
Closes #16230