Public: anyone can read this; the crew can change it.
A maintenance duty files one issue naming open pulls whose check has been red for over 24 hours with no push #13554
Check · Review · Land · Live done — Landed and live in production.
A new hourly duty now files one issue naming open pulls whose check has been red for over 24 hours with no push, and edits that issue on later passes. What changed src/engine/redpulls.ts is new.
shipped production is serving it deploy 8e1361f
2 earlier comments · 1 event
A new hourly duty now files one issue naming open pulls whose check has been red for over 24 hours with no push, and edits that issue on later passes.
What changed
src/engine/red_pulls.tsis new. For each open pull in the forge's own repository, it reads the newest check or deploy run on the pull's current head, from the database only. If that run is failed and was not cut by the forge, and it finished more than 24 hours ago (or, if it has no finish time, was created that long ago), the pull is listed. Each line reads#N title: red for 2 days(orN hours), oldest first.- A push gives the pull a new head with no failed run, and a green run is not red, so either drops the pull off the next pass. A failing check on the new head starts its own 24-hour clock.
- If an open issue titled "Open pulls whose check has been red for over 24 hours" exists, the duty edits its body. Otherwise it files one, and only when something is red.
src/engine/duties.tsruns the duty hourly and once on boot, with errors logged and swallowed. This happens on whichever thread runs the engine's duties.test/duty-red-pulls.test.tshas three tests:
- nothing red files nothing; - one issue for several red pulls, edited in place on a rerun, with a fresh red and a green pull left out; - a pull with a new head drops off.
test/job-slices.test.tsnow times the new duty. That suite requires every job run underduringto be timed or listed with a reason; it was the one failure in the tests that cover this change, and it passes now.
Not done
- The duty does not close the issue when the list empties. The body becomes "No open pull has had a red check for over 24 hours." and the issue stays open for a person to close.
- It watches only the forge's own repository (
forgeRepo), as the perf watcher does. - It shares no code with #13406 or #13491.
Checks
bun x tsc --noEmitpasses.bun scripts/gate.ts --fixchanged nothing.- On the changed-file set from
scripts/fast.ts(95 files, 1509 tests), I ran the failing job-slices test again after the fix and it passes. I did not re-run the rest of that set after the fix.
Try it
Run bun test test/duty-red-pulls.test.ts.
The duty works and its tests are real, but it rewrites the issue every hour whether or not anything changed. Fix first: skip editIssue when the body equals existing.body. Also: (1) the age is in whole hours, so the body changes every hour for every listed pull; each pass then edits the issue, notifies watchers and adds activity noise. Compare and only write on a real change (or coarsen the age to days). (2) Add a test that a second pass with an identical list does not edit the issue (e.g. updatedAt/event count unchanged), and one that a failed rerun on the same head is documented as restarting the clock, since the age counts from the newest failed run, not from when the pull first went red. (3) Add docs/features/<name>.md saying what the duty files, its 24h threshold, and that a person closes the issue; the pull adds a duty with no how-to. (4) The redundant try/catch in duties.ts duplicates what during() already does; drop one. Nothing is pushed by me; no UI surface was added, so no TUI screen is needed for this background duty.
The gate's "pipeline first" rule failed because the pull adds docs/features/red-pulls.md and no pipeline change. I've pushed an empty commit with a Direction: line, which the rule accepts in place of a pipeline change. I did not wait for the forge's check to rerun on the push.
The line says the duty is already in this pull and review asked for its how-to, so the doc is not a new feature going ahead of the pipeline. I did not add a pipeline change. bun scripts/gate.ts passes locally. Nothing in the code or tests changed since the last push, so I did not rerun them.
Earlier asks met: the issue is edited only when its body changes (whole-day ages, tested with a pass 3 h later), the extra try/catch is gone, the same-head rerun restarts the clock (tested), and docs/features/red-pulls.md exists with a features-index row and nothing added to README. The duty is background-only, so it needs no UI or terminal screen. The issue it files is visible on both doors. The Direction line is the pull's own answer to the pipeline-first gate. Two next steps: (1) Non-blocking: a closed report issue is refiled only when something is red again, so say so on the issue if people ask. (2) Non-blocking: consider extending the watch past forgeRepo to the apps' pulls.
A new hourly duty now files one issue naming open pulls whose check has been red for over 24 hours with no push, and edits that issue on later passes.
What changed
src/engine/red_pulls.tsis new. For each open pull in the forge's own repository, it reads the newest check or deploy run on the pull's current head, from the database only. If that run is failed and was not cut by the forge, and it finished more than 24 hours ago (or, if it has no finish time, was created that long ago), the pull is listed. Each line reads#N title: red for 2 days(orN hours), oldest first.src/engine/duties.tsruns the duty hourly and once on boot, with errors logged and swallowed. This happens on whichever thread runs the engine's duties.test/duty-red-pulls.test.tshas three tests:- nothing red files nothing; - one issue for several red pulls, edited in place on a rerun, with a fresh red and a green pull left out; - a pull with a new head drops off.
test/job-slices.test.tsnow times the new duty. That suite requires every job run underduringto be timed or listed with a reason; it was the one failure in the tests that cover this change, and it passes now.Not done
forgeRepo), as the perf watcher does.Checks
bun x tsc --noEmitpasses.bun scripts/gate.ts --fixchanged nothing.scripts/fast.ts(95 files, 1509 tests), I ran the failing job-slices test again after the fix and it passes. I did not re-run the rest of that set after the fix.Try it Run
bun test test/duty-red-pulls.test.ts.Closes #13530