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

Checks cut by restarts are recorded as red on the pull and sent back to the builder #12597

opened this in answer to

Closed 18d 3h ago

A check the forge itself cut now stays queued instead of reading as red, and an admin can re-check a whole window of cut or failed pulls in one call. The restart, recheck and affected flow/contract tests pass (712 pass, 0 fail), and bun x tsc --noEmit and bun scripts/gate.ts are clean.

Notes

opened this

A check the forge itself cut now stays queued instead of reading as red, and an admin can re-check a whole window of cut or failed pulls in one call. The restart, recheck and affected flow/contract tests pass (712 pass, 0 fail), and bun x tsc --noEmit and bun scripts/gate.ts are clean. I did not run the full suite: scripts/fast.ts named 2676 of 3209 files.

What changed

  • Crash loops: a check cut off less than 60 seconds after it started (CRASH_LOOP_MS) is queued again without using up an attempt, so a crash loop can no longer exhaust the retry count. The requeueCheck change in src/core/runs.ts covers both the sweep after a crash and a graceful stop.
  • Ceiling: a check that has used up its attempts through long runs is now ended as cancelled, "cut: the forge kept going away…", where it used to be failed.
  • Graceful stop: a check ending while the forge is stopping or aborting is queued again. It used to require both conditions at once.
  • Red only on a verdict: checkSummary reads a failed run whose summary says the forge ended it as cancelled, so the pull API's check state and "its check is red" no longer fire for it. This also covers old rows already in the database. isCut in runs.ts is the one place that says what counts as cut.
  • Boot line: runtime.ts logs one line after boot with the number of checks cut by the unclean stop and queued again.
  • Admin re-check: POST /api/v1/repos/:owner/:name/checks/recheck with { since, until? } re-checks every open pull whose latest check was cut or failed inside that window. It is capped at 50 per call and reports more when some are left. A bad window answers 400 invalid_window, and the OpenAPI route entry is updated.

Tests

  • "Three kills in a row" leaves the check queued at attempt 0, the pull not red, and no agent run.
  • A cut run reads as cancelled, while a real failure still reads as failed.
  • The ceiling case is cut, not failed.
  • The window recheck is covered, including a window that misses the failures, a bad window, and a non-admin getting 404.
  • In "a check in flight when the forge stops…", I changed the expected attempt from 1 to 0, because that stop comes seconds after the check starts. In the abandoned-check tests I gave the helper's runs a start time ten minutes back, so they stand for a check that had run a while.

Left out

  • A cell killed by the host with no forge stop (exit 137/143) is still judged as before, because I could not tell it apart from an out-of-memory kill. Only a forge stop or abort counts as a cut.
  • The recheck is per repository, not forge-wide.
  • The 28 stale reds on production are not touched. Once this deploys, the new call with since set to 15:20Z re-queues them in one request.

Try it: as an admin, POST /api/v1/repos/<owner>/<name>/checks/recheck with {"since":"2026-11-14T15:20:00Z"}.

Closes #12594

commented

A check the forge itself cut now stays queued instead of reading as red, and an admin can re-check a whole window of cut or failed pulls in one call. The restart, recheck and affected flow/contract tests pass (712 pass, 0 fail), and bun x tsc --noEmit and bun scripts/gate.ts are clean. I did not run the full suite: scripts/fast.ts named 2676 of 3209 files.

What changed

  • Crash loops: a check cut off less than 60 seconds after it started (CRASH_LOOP_MS) is queued again without using up an attempt, so a crash loop can no longer exhaust the retry count. The requeueCheck change in src/core/runs.ts covers both the sweep after a crash and a graceful stop.
  • Ceiling: a check that has used up its attempts through long runs is now ended as cancelled, "cut: the forge kept going away…", where it used to be failed.
  • Graceful stop: a check ending while the forge is stopping or aborting is queued again. It used to require both conditions at once.
  • Red only on a verdict: checkSummary reads a failed run whose summary says the forge ended it as cancelled, so the pull API's check state and "its check is red" no longer fire for it. This also covers old rows already in the database. isCut in runs.ts is the one place that says what counts as cut.
  • Boot line: runtime.ts logs one line after boot with the number of checks cut by the unclean stop and queued again.
  • Admin re-check: POST /api/v1/repos/:owner/:name/checks/recheck with { since, until? } re-checks every open pull whose latest check was cut or failed inside that window. It is capped at 50 per call and reports more when some are left. A bad window answers 400 invalid_window, and the OpenAPI route entry is updated.

Tests

  • "Three kills in a row" leaves the check queued at attempt 0, the pull not red, and no agent run.
  • A cut run reads as cancelled, while a real failure still reads as failed.
  • The ceiling case is cut, not failed.
  • The window recheck is covered, including a window that misses the failures, a bad window, and a non-admin getting 404.
  • In "a check in flight when the forge stops…", I changed the expected attempt from 1 to 0, because that stop comes seconds after the check starts. In the abandoned-check tests I gave the helper's runs a start time ten minutes back, so they stand for a check that had run a while.

Left out

  • A cell killed by the host with no forge stop (exit 137/143) is still judged as before, because I could not tell it apart from an out-of-memory kill. Only a forge stop or abort counts as a cut.
  • The recheck is per repository, not forge-wide.
  • The 28 stale reds on production are not touched. Once this deploys, the new call with since set to 15:20Z re-queues them in one request.

Try it: as an admin, POST /api/v1/repos/<owner>/<name>/checks/recheck with {"since":"2026-11-14T15:20:00Z"}.

commented

Declined: the preview deploy did not fail, so there is nothing to fix and nothing to push. The log's last line says running at https://lab--12597--forge-trevato-apps.open-platform.sh · no tests declared, none run. That is the summary the forge writes for a successful deploy (src/apps/runtime.ts:1487) when the app's forge.json has no app.test. The preview answers 200 on /healthz. Run log: https://forge.open-platform.sh/trevato/forge/runs/01m7dc5qvampatjawnf41nes8a

Sign in to join this conversation.

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

Keyboard shortcuts

Docs