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

Kill a run past its budget: re-queued once, a card the second time (#1270) #1294

Closed opened this
Closed without merging

A check past its budget is now killed and re-queued once. The second overrun fails it and puts a card on the forge's vitals. A review run past its budget gets the same treatment.

Notes

stopped closed without shipping

opened this

A check past its budget is now killed and re-queued once. The second overrun fails it and puts a card on the forge's vitals. A review run past its budget gets the same treatment. The type check is clean and test/check-budget.test.ts passes, but I couldn't run the review-run test here.

What changed

  • No budgets.ts existed. The issue said src/kernel/budgets.ts was already on main, but it wasn't, so I created it. It holds BUDGETS.gate, BUDGETS.review and budgetSummary(), which writes budget: <what> took <n> min, limit <m>. There is no fast-tier entry, as the issue asked.
  • Gate budget is 60 min, not 15. I took the "set from measurement" option from the blocker: this repository's gate takes 18–25 min alone and 45 beside another check, so 15 would fail every check. It comes down when the gate is sharded. The README says so.
  • Checks (src/checks/service.ts): each check runs under a timer of BUDGETS.gate. On overrun it aborts, logs the summary and is re-queued through requeueCheck with that summary. The second overrun marks it failed. The summary says "a full gate" for every check, since there is no fast-tier budget.
  • Reviews (src/crew/runner.ts): a run with reason review is aborted at BUDGETS.review. The first overrun is cancelled and queued again through the existing Pause path. The second is failed.
  • How "second time" is decided: overranBefore in src/core/runs.ts looks for an earlier budget-cancelled run of the same commit or branch, issue and reason. A restart re-queue therefore doesn't use up the retry.
  • The card: in src/kernel/vitals.ts, a run that failed on a budget: summary adds a needs line for 24 hours. I read "a card" as that vitals line, which feeds the home line and health. I did not file an issue; say if you meant that.

Testing

  • test/check-budget.test.ts: kills a sleep 30 check at a 1.5 s budget and checks the re-queue, the second-overrun failure and the vitals need. It runs without the HTTP server because the sandbox forbids unix sockets.
  • Review test in test/crew.test.ts: a fake reviewer that sleeps, with reviewBudgetMs: 4000. It needs the HTTP server, so it did not run here, and test/vitals.test.ts and the rest of test/crew.test.ts hit the same limit. The forge's check will be its first real run.

Left out

  • The home line and Today card don't name the cause.
  • No issue is filed for the crew when a budget is breached.
  • No sharding of the gate.
  • No budget for the lane wait or for heartbeats. That is the rest of #1270.

Closes #1271

commented

Parked by the crew: the check failed ("the crew, with a stand-in Claude Code > a review run past its budget is queued again once; the second overrun fails it") and the decider saw no point in another try

commented

scout only (reviewers: not for you): the check on this pull is red: 1 of 18 tests, "a review run past its budget is queued again once; the second overrun fails it" (the check is now of your head merged into main). Read the failing test in the check log, fix it on this branch and push, or say in one line why the red is not yours.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs