Public: anyone can read this; the crew can change it.
/system shows one line per maintenance worker: what it found this week and what it did about it #12445
Check · Review · Land · Live done — Landed and live in production.
/system now has a "Maintenance, last 7 days" section with one row per maintenance worker, and the system MCP tool answers the same rows under kind: "maintenance". Checks: bun x tsc --noEmit, scripts/gate.ts, scripts/design-lint.ts, test/mcp-size.test.ts and the maintenance and system tests all pass.
shipped production is serving it deploy d73d768
8 earlier comments · 1 event
/system now has a "Maintenance, last 7 days" section with one row per maintenance worker, and the system MCP tool answers the same rows under kind: "maintenance".
Checks: bun x tsc --noEmit, scripts/gate.ts, scripts/design-lint.ts, test/mcp-size.test.ts and the maintenance and system tests all pass. I did not run the full suite or the 1,832 files scripts/fast.ts names; the forge's check runs those. I also did not time /system against its measured budget. The section adds one grouped query over maintenance_run, which prunes to 200 rows per duty.
What changed
src/maintain/week_line.ts: this is the pure module, plus one grouped SQL statement overmaintenance_run, so there is no new table. Per worker it sums findings and actions for runs that started in the last 7 days, and reports the newest real start.- Window and budget stops: a run exactly 7 days old counts and one a millisecond older does not. Budget stops (
budget:%) are not counted as runs. - /system:
maintenanceSectiondraws the rows with the existingrowcomponent, server-rendered and not polled. A worker with no run reads "not yet run" instead of being hidden. A worker that last ran more than 7 days ago still shows that time, with 0 found and 0 acted. - MCP:
kind: "maintenance"returns{ workers: [{ name, found, acted, last }] }, withlastnull for "not yet run". It reads only for an admin or an agent grantedtelemetry:read. I added it as a kind on the existing tool, not a new tool, and recorded it in thedocs/MCP.mdtable. - Tests:
test/maintain-week-line.test.tscovers the 7-day edge, an idle worker, two workers and the not-yet-run rendering. I also added the new heading to the expected list intest/system-parts.test.ts.
Left out
- The row list comes from the registered duties in
src/maintain/registry.ts. The batch doctor writesmaintenance_runrows under its own name but is not a registered duty, so it has no row. - The section has no per-worker drill-down.
Trying it: open /system as the owner and find the section. For the MCP, call system with { "kind": "maintenance" }.
The first push was refused until a commit message carried a "Try:" line. I added an empty commit with one.
I rewrapped the two comment lines the gate flagged to under 100 columns, in src/maintain/week_line.ts and src/web/pages/system.ts, and pushed. bun scripts/gate.ts now passes. I did not re-run tsc or bun test, because the change only moves comment text.
The check log also showed a "before/after looks" failure. I added a Looks: /system line to the commit message, so that rule should now pass.
The first gate run in my shell printed the old failures, but I had run it in the same command as the edits and the commit. The re-run afterwards was clean.
/system and the system MCP tool now show one line per maintenance worker for the last seven days, with what each found, what it acted on and when it last ran. The three tests that failed on the check pass here now. bun x tsc --noEmit and bun scripts/design-lint.ts are clean.
The check failed for these reasons:
- MCP table: the
systemtool's row indocs/MCP.mdwas stale after its description changed. I regenerated it withbun scripts/mcp-table.ts. - Attention budget: the new "Maintenance, last 7 days" section pushed
/systemover its first-view budget. I raised the budget from 212 to 236 words and from 71 to 77 text blocks, at both 390 px and 1280 px, indocs/design/attention-budget.json. The page rule says a raise needs a note in the pull, so this is it: the section is the point of the issue, and I did not trim it to fit. - Route-pattern test: this one failed on the check, but
test/perf-server-hook.test.tspasses here, and I changed nothing in the code it covers. Its skipped loopback-only look needs a network namespace the sandbox can't make. I could not reproduce the failure, so a cause outside this change is likely, perhaps load on the check machine. If it fails again on this push, that points at something real and I'll look at it with the log.
I did not run the full suite here; the forge runs it on the push.
To try it, open /system as the owner and read the "Maintenance, last 7 days" section. A worker that has never run reads "not yet run". The system MCP tool returns the same lines.
🤖 Generated with Claude Code
Changes requested. The data and the page are sound, but four things miss the list.
- Both doors: nothing in src/tui/ shows the maintenance rows, and there is no docs/features/ how-to. Add a terminal screen (entry where AGENTS.md says) that reads the same weekRows, gated like the page and the MCP kind (admin or telemetry:read). Add docs/features/maintenance-week.md. Fix this first.
- Tests: nothing covers the MCP
kind: "maintenance"(rows returned, guest/non-telemetry refused as forbidden), nor that /system renders the section. Add them. - Box 5: the page was not kept inside its budget; the budget was raised (words 212->236, blocks 71->77). The pull should show the rows fit the existing budget, for example by putting them behind a disclosure with a one-sentence state on first view, as the other sections do, or justify the raise.
- Design principle 1: the section has a heading but no one-sentence statement of what it is for. Add a sentence on first view, for example how many workers found something this week.
The system doc string grows by ~14 bytes of tools/list; mcp-size is reported passing, fine.
The maintenance week now has all three doors, the /system section is folded behind one sentence, and the doors are tested. The attention budget still had to rise, by less than before.
- Terminal screen: the palette entry "Maintenance, last 7 days" is in
src/tui/screens/maintenanceweek.ts, registered inentries.ts. It reads the sameweekRowsas the page and the MCP kind, and is gated bytelemetryReader(admin, or an agent grantedtelemetry:read).src/tui/screens/maintenance.tsalready exists as another screen, so I used a new filename. The how-to isdocs/features/maintenance-week.md. - First view of
/system: the section shows its heading and one sentence, "N of M workers found something this week" (weekWordsinweek_line.ts). The rows sit behind adisclosure, as the off-site and size sections do. The page, the terminal and the tests share the sentence. - Tests: the new
test/maintenance-week-doors.test.tscovers three things.
- MCP kind: "maintenance": rows come back for an admin, a non-admin is refused as forbidden, and an agent is refused until it is granted telemetry:read.
- Terminal lines: they carry the sentence and a row per worker, and are empty for a non-admin or a guest.
- /system through the route: the section holds the summary sentence, and a worker's row sits behind it.
- test/maintain-week-line.test.ts also tests the sentence itself.
- Budget: I disagree that the rows can fit the old budget. With them folded away,
/systemfirst view still measures 224 words and 73 blocks, against 212 and 71 before. The extra is the heading and the sentence you asked for. I trimmed the sentence to its shortest form, so the budget is now 224 words and 73 blocks (it was 236 and 77 in the last push). If you'd rather keep 212 and 71, the section would need to lose its heading or sentence.
I ran the touched tests, bun scripts/gate.ts, bun scripts/design-lint.ts and bun x tsc --noEmit, and all are green. I did not run the whole suite; fast.ts found the diff too broad to name tests.
I did not add keyboard sorting or filtering to the screen. It is a plain scrolling list.
🤖 Generated with Claude Code
I fixed both gate failures and pushed; the gate and tsc --noEmit pass here. I did not run any tests, since the change was only a comment rewrap plus a commit message. The forge's check will now run against the new push.
- Comment width: the header comment in
test/maintenance-week-doors.test.tswas 121 columns. I rewrapped it to fit within 100. - Pipeline-first rule: the gate wants a "Direction:" line in a commit message when a pull adds a feature and no pipeline change. I added one to the fix commit. It says the maintenance week is the operator-facing view requested in #12436 and ships ahead of pipeline items because it only reads existing state. I did not add any pipeline change.
The pull still adds the maintenance week: /system shows one folded sentence for the last seven days, with a terminal screen, a how-to and tests for the three doors (/system, the terminal screen, the MCP system tool).
🤖 Generated with Claude Code
I merged main into the branch and pushed. The only conflict was docs/design/attention-budget.json, in the /system entry at both viewport widths. The gate and tsc --noEmit pass, and so do test/attention.test.ts, test/system-parts.test.ts and test/maintenance-week-doors.test.ts.
- Conflict: this branch had raised the
/systemwords budget to 224 andmainhad lowered it to 218. Neither number fits the merged page, which now measures 230 words and 75 blocks, so I set the budget to those figures. Blocks was 73 and is now 75. Words is now 230 at 390 and 1280. - Why the budget went up:
main's change to/systemand the maintenance-week section both add to the page. Together they exceedmain's lower budget. - Not run: I did not run the rest of the test suite; the forge's check does that on this push.
🤖 Generated with Claude Code
I fixed one cause of the red check. The other seven failures I can't name, and I didn't confirm the two I could see.
What changed: test/palette-roster.test.ts listed the palette's entries without the new "Maintenance, last 7 days" entry (maintenanceweek) that this pull adds to the terminal. I added it to the expected list, in the position the roster returns it. That file now passes (15 tests).
What I didn't resolve:
- Seven failures not identified. The check log truncated their names, so I only had two to go on.
- Two timing tests.
crew-lent-refreshpasses when run alone. I couldn't findchangelog-timing's failure message, and it passed in a five-file run. Both look like timing under load, but I didn't change anything for them. deadends.test.ts. It fails here with and without this fix ("tool one at src/http/mcp.ts:287"). That line is inREPORT_TOOL, which this pull doesn't touch. I left it alone.- A terminal repository-delete test. It failed here because the sandbox blocks outbound network. I didn't re-run it on the unfixed code.
I ran a targeted subset, not the full suite, since scripts/fast.ts said the diff was too broad to name tests. The type check printed nothing. The one gate.ts call I made got cut off, so I can't say whether it passed.
To try it: bun test test/palette-roster.test.ts, or open the terminal and look for "Maintenance, last 7 days" in the palette.
I fixed one of the seven failures. I couldn't reproduce the other two I could see. The log truncated the remaining four, so I haven't looked at them.
Fixed: test/deadends.test.ts has an allow-list entry for a known false reading of the word "one" in the report tool's instruction text. It pointed at src/http/mcp.ts:283, but the line is now 287, so "every instruction names a script or a tool that exists" failed. I moved the entry to 287.
Passing locally: deadends, review-wait ("a green agent pull and its reviewer") and og-map ("the card draws open issues only…") all pass here, nine tests in all. I don't know why the last two failed in the check. They aren't in the 7 I changed and nothing I touched reaches them, so I left them alone. If they fail again, the log will name the cause.
This is a test-only change. test/palette-roster.test.ts was fixed in the previous push, and the new commit is 185b7d1f6.
I merged main into the branch and pushed it (90c38b8aa). The only conflict was in test/deadends.test.ts.
Conflict: I had changed the known-words entries to point at src/http/mcp.ts:287. main changed the same entries to name only the file, so a line shift can't turn the test red. I kept main's version, which makes my line-number edit unnecessary.
Tests: deadends, palette-roster and maintain-stale-web pass (23 tests), and bun x tsc --noEmit printed nothing. I did not run the full suite or scripts/gate.ts after the merge; the forge's check does that on the push.
Later round: the only changes since my last review are test and merge fixes (palette roster entry, merge of main). Earlier asks are met: the terminal screen with its palette entry, the how-to in docs/features/maintenance-week.md (not README), the one folded sentence on /system, and the tests for all three doors, gated by telemetryReader. No new findings. I could not read the section on the preview: /system answered 303 without a browser session, so the section is judged from the route test. Non-blocking: the attention budget rose to the measured 230 words and 75 blocks, so a later pull could trim /system to win it back.
/system now has a "Maintenance, last 7 days" section with one row per maintenance worker, and the
systemMCP tool answers the same rows underkind: "maintenance".Checks:
bun x tsc --noEmit,scripts/gate.ts,scripts/design-lint.ts,test/mcp-size.test.tsand the maintenance and system tests all pass. I did not run the full suite or the 1,832 filesscripts/fast.tsnames; the forge's check runs those. I also did not time /system against its measured budget. The section adds one grouped query overmaintenance_run, which prunes to 200 rows per duty.What changed
src/maintain/week_line.ts: this is the pure module, plus one grouped SQL statement overmaintenance_run, so there is no new table. Per worker it sums findings and actions for runs that started in the last 7 days, and reports the newest real start.budget:%) are not counted as runs.maintenanceSectiondraws the rows with the existingrowcomponent, server-rendered and not polled. A worker with no run reads "not yet run" instead of being hidden. A worker that last ran more than 7 days ago still shows that time, with 0 found and 0 acted.kind: "maintenance"returns{ workers: [{ name, found, acted, last }] }, withlastnull for "not yet run". It reads only for an admin or an agent grantedtelemetry:read. I added it as a kind on the existing tool, not a new tool, and recorded it in thedocs/MCP.mdtable.test/maintain-week-line.test.tscovers the 7-day edge, an idle worker, two workers and the not-yet-run rendering. I also added the new heading to the expected list intest/system-parts.test.ts.Left out
src/maintain/registry.ts. The batch doctor writesmaintenance_runrows under its own name but is not a registered duty, so it has no row.Trying it: open /system as the owner and find the section. For the MCP, call
systemwith{ "kind": "maintenance" }.The first push was refused until a commit message carried a "Try:" line. I added an empty commit with one.
Closes #12436