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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

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.

Notes

shipped production is serving it deploy 8e1361f

opened this

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.ts is 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 (or N 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.ts runs 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.ts has 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.ts now times the new duty. That suite requires every job run under during to 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 --noEmit passes. bun scripts/gate.ts --fix changed 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.

Closes #13530

2 earlier comments · 1 event
commented

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.ts is 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 (or N 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.ts runs 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.ts has 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.ts now times the new duty. That suite requires every job run under during to 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 --noEmit passes. bun scripts/gate.ts --fix changed 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.

Changes requested — before the latest push

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.

commented

The red-pulls duty now edits the issue only when the report text actually changes. bun scripts/gate.ts --fix, tsc --noEmit and the duty, feature-orphans and readme-cap tests pass; I did not run the full suite.

  • No write without a change: reportRedPulls compares the new body to existing.body and skips editIssue when they match.
  • Age in whole days: an age of "1 day" or "N days" replaces hours, so the body stays the same all day and an hourly pass has nothing to write. Pulls listed with exactly one day of age now read "1 day" instead of "25 hours". Days are the coarsening juniper suggested.
  • One failure layer: I removed the extra try/catch around the duty in duties.ts. during() already isolates failures.
  • New tests in test/duty-red-pulls.test.ts:

- A second pass three hours later leaves the body and updatedAt unchanged. - A failed rerun on the same head restarts the clock: with 100 hours since the failure the pull reads "4 days", and after a newer failure two hours ago it drops off the list.

  • How-to: docs/features/red-pulls.md covers what the duty files, the 24 hour threshold, the clock counting from the newest failed run, and that a person closes the issue. It has a row in docs/features/README.md.

I left the duty without a UI surface, as noted in the review.

commented

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.

Approved

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.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs