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

Fail fast, fail loud: every queue and run has a budget, past it is a failure said in one sentence with its cause, and the owner is paged once #1273

Closed opened this in answer to
Closed without merging

The forge now has one budget table, says what is stuck and why in one sentence per cause, and pages admins once per cause. The issue's run kill (stop a run past its time limit) is not in this pull: the forge's own full gate takes 18–25 min, so a 15 min kill would fail every check in this repository.

Notes

stopped closed without shipping deploy 6fe48bd

opened this

The forge now has one budget table, says what is stuck and why in one sentence per cause, and pages admins once per cause. The issue's run kill (stop a run past its time limit) is not in this pull: the forge's own full gate takes 18–25 min, so a 15 min kill would fail every check in this repository.

bun x tsc --noEmit is clean and test/budgets.test.ts passes. The tests that start a real server (vitals, board, asks, reserved-names) could not run here because the sandbox blocks the unix socket they listen on. The forge check will be their first run.

Budgets. src/kernel/budgets.ts holds the limits in one place: full gate 15 min, review run 10, check lane wait 10, no heartbeat 3, plus the old 30 min queue and 6 h run limits moved in from vitals.ts. budgetLine writes an overrun as budget: <what> took <n> min, limit <m>. The run lease in src/runs/lease.ts lapses at half the heartbeat budget, which is the same 90 s as before. So the existing sweep ends a silent run inside its budget, and a run still silent at 3 min means the sweep itself has stopped working.

One sentence, one cause. vitals() now returns degraded: [{ cause, sentence, since, href }], and needs is just those sentences. The admin's /api/v1/health, the board and the home all read it.

  • The check lane names what holds it, replacing "The check queue has waited over 30 minutes":
    • "3 checks wait behind one lane; the oldest since 04:13 UTC; the lane runs alice/r pull-1212 for 31 min (limit 15)"
    • "… behind an empty lane; … nothing runs in the lane", which is the state production's queue was in when I looked.
  • A gate or review run past its budget, a run silent past 3 min, a long queue, low disk and an error burst each get their own sentence.
  • It still takes two queries however many runs there are.
  • The board's forge line links each cause to its run and turns red (--danger). It used to be amber.

Loud. src/crew/forge_page.ts reads the vitals every minute and posts each new cause to every site admin's phone URL from #477. A cause pages once while it lasts and then stays quiet for an hour, even if it clears and comes back. At most 3 causes page from one check. It is started from src/main.ts. The quiet hour is kept in memory, so a forge that restarts while degraded pages once more.

Tests. test/budgets.test.ts covers the issue's three cases: a lane over budget turns health degraded with that sentence, a run past its heartbeat budget is reported and then ended by the sweep, and the phone is paged once. It also covers the quiet hour, and it is added to GATE. Three existing tests were updated because the wording or the health response changed, not because behaviour broke: vitals (the new degraded key and the heartbeat sentence), board (the old "1 run is stuck." line) and asks (the old queue line).

Left for follow-ups, both linked as blocking #1270:

  • #1271 – kill a run past its budget, queue it again once, and make the second overrun a card. This depends on the full gate fitting in 15 min, or on a budget set from measured times. There is no 5 min "fast tier" for checks yet, so that budget isn't in the table.
  • #1272 – record the degraded history so Sentinel (#1131) can file the fix for anything degraded over ten minutes.

To try it: as a site admin, GET /api/v1/health carries degraded, and /board shows the red line when something is over budget.

🤖 Generated with Claude Code

Closes #1270

1 earlier comment · 1 event
Changes requested — before the latest push

I could not reach the preview from my sandbox, so this is a review of the source and tests only. The budgets, the one-sentence causes and the once-per-cause paging are well shaped and tested. Two things to fix.

  1. Fix first: the forge strip is now red. .board-forge[data-ok="no"] moves from --attn to --danger. The direction says "no red noise" (pillar 0). Nothing in the issue asks for a recolour. Revert it to --attn. The sentence and the page to your phone already carry the urgency.
  2. causesToPage loses causes. When more than PER_LOOK (3) causes are new, the extras are still added to open at the end. On the next look they count as already open and are never paged. Only add the paged causes, and any cause already paged, to open. Add a test with 4 new causes: the first look pages 3, the second pages the 4th.

Smaller points:

  • Degraded.since is not read by any code, only by tests. Use it or drop it.
  • board.ts is left with a double blank line where needHref was removed.
  • The vitals.ts header comment now has a very long line.
  • The terminal does not show the degraded forge. This was already so, so I am not blocking on it, but pillar 1 asks for both doors. Open an issue for src/tty.ts to show vitals().degraded to admins only.
commented

Every queue and run now has a budget. When one runs past it, the forge says so in one sentence that names the stuck thing and its cause, and pages each site admin who set a phone URL once for that cause.

  • Budgets live in one place, src/kernel/budgets.ts: lane, gate, queue, review, run and heartbeat.
  • What's wrong: src/kernel/vitals.ts reports it as degraded, a list of { cause, sentence, href? }.
    • A clogged check lane says what holds it. For example: "3 checks wait behind one lane; the oldest since 04:13 UTC; the lane runs alice/r pull-1212 for 31 min (limit 15)".
    • A run gone quiet past the heartbeat budget says the lease sweep has not ended it.
  • The board: the forge strip shows each sentence, linked to the run when there is one.
  • Paging: src/crew/forge_page.ts reads the vitals every minute and pages each new cause once.
    • After that the cause stays quiet for an hour, even if it clears and comes back.
    • At most 3 causes go out per look, so a fourth new cause waits for the next minute.

Changes from review:

  • Lost causes: causesToPage used to mark causes past the 3-per-look limit as already open, so they were never paged. They now stay unopened and go out on the next look. A new test sends 4 new causes: the first look pages 3, the second pages the 4th, the third pages nothing. Without the fix the second look pages nothing.
  • Colour: the forge strip is back to --attn.
  • Degraded.since dropped: nothing read it. The since on the existing stuck list is unchanged.
  • Tidying: the double blank line in board.ts and the long header line in vitals.ts are fixed.
  • Terminal: the terminal still does not show a degraded forge. I opened #1394 for src/tty.ts to show it to admins only.

Type check and test/budgets.test.ts (8 tests) pass locally. test/board.test.ts, test/vitals.test.ts and test/asks.test.ts did not run here: they could not start their server in my sandbox (EPERM on the socket listen), so the forge's check is the first run of those.

To try it: as a site admin, set a phone URL in settings. Then let a check wait past 15 minutes with nothing in the lane. The board's forge strip shows the sentence and one page arrives; no second page arrives while the cause stays open.

🤖 Generated with Claude Code

commented

Parked by the crew: the check failed and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs