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

A maintenance duty that throws three runs in a row is shown as failing on /maintenance and in the maintenance tool #12699

opened this

Merged 21d 0h ago, live in production

A duty that fails three runs in a row now reads "failing since 2030-01-01 00:00 UTC: boom" on its /maintenance row and in the MCP maintenance tool's status read. A success, or a resume, clears it. I ran maintain-failing, maintain-pause, maintain, maintenance and mcp-size (all green), plus tsc and scripts/gate.ts.

Notes

opened this

A duty that fails three runs in a row now reads "failing since 2030-01-01 00:00 UTC: boom" on its /maintenance row and in the MCP maintenance tool's status read. A success, or a resume, clears it. I ran maintain-failing, maintain-pause, maintain, maintenance and mcp-size (all green), plus tsc and scripts/gate.ts. design-lint and the before/after looks were not run, because no file under src/web/ changed.

  • Runner (src/maintain/runner.ts): it already recorded a thrown handler as a failed run. It now keeps only the first line of the error message, so a stack trace never reaches a row.
  • Failing line (src/maintain/pause.ts): a new failing() finds the run of consecutive errored runs since the last resume. At three or more it gives the time the streak started and the first line of the latest error.
  • Page and MCP: both already print each duty's state text, so they pick up the new line with no change to src/web/pages/maintenance.ts or src/http/mcp/tools/maintenance.ts. The MCP size ceilings are untouched.
  • Budget stops: they don't count as failures, even though the pause logic treats any non-ok outcome as an error.
  • Bug fixed along the way: a duty's first pause set its resume mark to the latest run, which would have hidden the failing streak. A first pause now leaves the mark at the start, and a resume still sets it.
  • Test (test/maintain-failing.test.ts, new): a duty that throws shows "failing since … boom" only on the third run, with no stack line. An "ok" run clears it, and a budget stop doesn't trigger it.

What I left out: a duty pauses itself after the third error, so in practice the line appears on a paused row too, appended after "paused …". The clearing-by-success test records an "ok" run directly, because a paused duty doesn't run again until someone resumes it.

To try it: bun test test/maintain-failing.test.ts.

Closes #12679

3 earlier comments
commented

A duty that fails three runs in a row now reads "failing since 2030-01-01 00:00 UTC: boom" on its /maintenance row and in the MCP maintenance tool's status read. A success, or a resume, clears it. I ran maintain-failing, maintain-pause, maintain, maintenance and mcp-size (all green), plus tsc and scripts/gate.ts. design-lint and the before/after looks were not run, because no file under src/web/ changed.

  • Runner (src/maintain/runner.ts): it already recorded a thrown handler as a failed run. It now keeps only the first line of the error message, so a stack trace never reaches a row.
  • Failing line (src/maintain/pause.ts): a new failing() finds the run of consecutive errored runs since the last resume. At three or more it gives the time the streak started and the first line of the latest error.
  • Page and MCP: both already print each duty's state text, so they pick up the new line with no change to src/web/pages/maintenance.ts or src/http/mcp/tools/maintenance.ts. The MCP size ceilings are untouched.
  • Budget stops: they don't count as failures, even though the pause logic treats any non-ok outcome as an error.
  • Bug fixed along the way: a duty's first pause set its resume mark to the latest run, which would have hidden the failing streak. A first pause now leaves the mark at the start, and a resume still sets it.
  • Test (test/maintain-failing.test.ts, new): a duty that throws shows "failing since … boom" only on the third run, with no stack line. An "ok" run clears it, and a budget stop doesn't trigger it.

What I left out: a duty pauses itself after the third error, so in practice the line appears on a paused row too, appended after "paused …". The clearing-by-success test records an "ok" run directly, because a paused duty doesn't run again until someone resumes it.

To try it: bun test test/maintain-failing.test.ts.

commented

The gate now passes. I had piped the earlier gate run to tail before the rewrap was written, so that run showed the old errors, and I pushed anyway. The push is ce629d620.

  • What changed: I rewrapped the two comments that were over 100 columns, src/maintain/pause.ts:49 and the header of test/maintain-failing.test.ts. No code changed.
  • Checks I ran: bun scripts/gate.ts is clean, tsc showed no errors, and bun test test/maintain-failing.test.ts passes 3 of 3.
commented

All four of juniper's points are fixed and pushed as 0bbb2d7cb. The gate and tsc are clean. Six test files pass, including mcp-size.

  1. Paused row said the error twice. When the runner paused the duty, the row now appends only failing since <time>, because its own reason already carries the error. A duty paused by a person, or still on, keeps the full failing since <time>: <first line>.
  2. Pause and failing disagreed on budget stops. I chose to make errored() itself exclude budget: outcomes, and said so in its comment. pauseOnErrors and failing() now both skip budget rows in their queries. Three budget stops no longer pause a duty, and a stop in the middle of a streak no longer splits it. This changes the earlier pause behaviour: it used to pause on three budget stops.
  3. Tests.
    • A duty that throws is paused by the runner on the third run, and its failing text appears on the page, in the MCP status read and in the terminal lines.
    • switchDuty resume then clears all three.
    • The paused row contains "boom" exactly once.
    • Another test covers a budget stop in the middle of a streak.
    • I did not run the test against the old put() to confirm it fails there. It should, because the old code hid the streak right after the first pause.
  4. Terminal. dutyLines from dutyswitch.ts is asserted alongside the page and the MCP.

No web files changed, so I did not run design-lint or take looks.

commented

A duty that throws three runs in a row now pauses and says "failing since <time>: <first line>", once, on /maintenance, in the maintenance MCP tool's status and in the terminal duty list. A person's resume clears it everywhere.

This push only fixes the failed check. The gate refused test/maintain-failing.test.ts for casting a fake session as never. The terminal check now builds a real Session from the stored admin user, and the MCP reply is typed instead of as any. I also dropped the as unknown as Duty cast on the thrower duty. The gate, tsc --noEmit and test/maintain-failing.test.ts (4 pass) are green locally. I did not run the wider suite; the forge's check does that on push.

I left out an expiry on the failing line, so it stays until the next successful run or a resume. To try it, make a duty throw three times, then open /maintenance.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs