Public: anyone can read this; the crew can change it.
A "Revert …" pull left open past a day is landed or closed with its reason, by the forge #15810
Check · Review · Land · Live done — Landed and live in production.
Adds a maintenance duty, revert-pulls (src/maintain/duties/revertpulls.ts). It runs every six hours and looks at open pulls titled Revert "…" that are more than 24 h old.
shipped production is serving it deploy 3fede26
2 earlier comments · 1 event
Adds a maintenance duty, revert-pulls (src/maintain/duties/revert_pulls.ts). It runs every six hours and looks at open pulls titled Revert "…" that are more than 24 h old. It reads each repository's base-branch log once (2000 commits deep), checks the pull's head check, and decides:
- Already on main: the base already has a commit with the revert's own title, alone or with
(#N)after it. The pull is closed with the comment "already on main as<oid>". - Red: the original change is still on the base but the revert's check failed. The pull is closed with a comment naming the original commit.
- Green: the original is still on the base and the check passed. The pull stays open and is listed in the run's findings as waiting for a person to land, naming the original commit.
- Anything else (no check yet, or the original isn't on the base) is left alone.
Closes are made by the forge's engine account, as a parked close followed by one comment. Each close is a line in the run's actions, so it appears in GET /api/v1/maintenance/runs. The duty never closes a pull a person opened, a pull a person has commented on, or one assigned to a person. It doesn't touch the release workflow or the chart.
What differs from the issue:
- Green reverts are not landed. The issue asks to land them through the normal gate, but that gate refuses any agent as the one who merges ("the crew proposes, a person lands"). The engine account's own rules also say it never merges. Landing them would mean merging as a person who didn't decide to, so they are listed for a person instead.
- Stale reverts are not closed. The issue's "closes the stale/red ones" never says what stale means. A revert whose original isn't on the base and which hasn't been reverted is left open, not guessed at.
- Different files. The duty is one new file in
src/maintain/duties/, which is how this repository adds duties (per AGENTS.md).src/core/maintenance.tsdoesn't exist andsrc/core/merges.tsdidn't need to change. - No
keep_planorestimatecalls. Those tools weren't available in this run, so the issue has no plan and no time was promised.
How it was tested: test/revert-pulls-duty.test.ts sets up a repository whose main has Add widget, Add knob, Add gadget, Revert "Add gadget" and Add dial. It opens three fixture pulls and runs the duty through the real maintenance runner. The green pull stays open and is in the findings. The red pull is closed and its comment names the Add knob commit. The already-reverted pull is closed and its comment names the revert's commit. The stored run has exactly those two closes. Three guard pulls stay open: one under a day old, one opened by a person, one with a person's comment. A second pass closes nothing. The test fails without the change because the module doesn't exist. bun scripts/gate.ts --fix rewrapped comments, which are committed. bun x tsc --noEmit is clean, and the 124 test files named by scripts/fast.ts pass (1937 tests).
To try it: on a preview, sign in as an admin and wait for the duty's run (or open GET /api/v1/maintenance/runs), then look for revert-pulls rows.
🤖 Generated with Claude Code
Adds a maintenance duty, revert-pulls (src/maintain/duties/revert_pulls.ts), that runs every six hours over open pulls titled Revert "…" that are more than 24 h old. It reads each repository's base-branch log once (2000 commits deep), checks the pull's head check, and handles each pull one of four ways:
- Already on main: the base already has a commit with the revert's own title (alone or followed by
(#N)). The pull is closed with the comment "already on main as<oid>". - Red: the original change is still on the base and the revert's check failed. The pull is closed with a comment naming the original commit.
- Green: the original is still on the base and the check passed. The pull stays open and is listed in the run's findings as waiting for a person to land, naming the original commit.
- Anything else (no check yet, or the original isn't on the base) is left alone.
Closes are made by the forge's engine account: it closes the pull as parked and adds one comment. Each close is a line in the run's actions, so it appears in GET /api/v1/maintenance/runs. The duty never closes a pull that a person opened, commented on, or is assigned to. It does not touch the release workflow or the chart.
Where this differs from the issue:
- Green reverts are not landed. The normal merge gate refuses any agent as the one who merges ("the crew proposes, a person lands"), and the engine account never merges. Landing them would mean merging as a person who didn't decide to, so they are listed for a person instead.
- Stale reverts are not closed. The issue doesn't say what "stale" means, so a revert whose original isn't on the base and that hasn't itself landed is left open.
- Different files. The duty is one new file in
src/maintain/duties/, which is how this repository adds duties (AGENTS.md).src/core/maintenance.tsdoesn't exist, andsrc/core/merges.tsdidn't need to change. - No plan or estimate on the issue. The
keep_planandestimatetools weren't available in this run, so nothing was posted and no date was promised.
The second commit adds no code. It carries the Direction: line the gate's "pipeline first" rule asks for when a pull adds a feature module and no pipeline change: it names #15804 and the pipeline item #6534 it goes ahead of. The rule failed the first push, and bun scripts/gate.ts now passes.
test/revert-pulls-duty.test.ts fails without the change. It sets up a repository whose main has Add widget, Add knob, Add gadget, Revert "Add gadget" and Add dial, then runs the duty through the real maintenance runner:
- Green pull: stays open and appears in the findings.
- Red pull: closed, with a comment naming the
Add knobcommit. - Already-reverted pull: closed, with a comment naming the revert's commit.
- Stored run: has exactly those two closes.
- Guard pulls: three stay open (one under a day old, one opened by a person, one with a person's comment).
- Second pass: closes nothing.
Checks run here:
- First push:
bun x tsc --noEmitwas clean and the 124 test files named byscripts/fast.tspassed (1937 tests). - This push: only the new test and the duty roster test were re-run, and they pass.
To try it on a preview, sign in as an admin and open GET /api/v1/maintenance/runs after the duty has run; look for revert-pulls rows.
🤖 Generated with Claude Code
Approved. The duty is one small module in src/maintain/duties/, registered the way AGENTS.md describes. It closes only as the engine, never a pull a person opened, commented on or was assigned, and it writes each close into the run actions. The test drives the real runner with green, red, already-reverted and three guard pulls, and fails without the module. I did not exercise the preview: this is a background duty with no page, so there is no UI to check. Not blocking, but two things I would do next: (1) Landing green reverts is a deliberate deviation from the issue, because the gate refuses an agent as merger. Open a follow-up so that a person can land them in one action from the finding. (2) The already-on-main check matches a Revert commit anywhere in 2000 commits of log. If the original was re-landed after that revert, the pull is wrongly closed. Compare positions in the log, so that the revert counts only when it is newer than the original. Also drop the as any in the test helper.
Adds a maintenance duty,
revert-pulls(src/maintain/duties/revert_pulls.ts). It runs every six hours and looks at open pulls titledRevert "…"that are more than 24 h old. It reads each repository's base-branch log once (2000 commits deep), checks the pull's head check, and decides:(#N)after it. The pull is closed with the comment "already on main as<oid>".Closes are made by the forge's engine account, as a
parkedclose followed by one comment. Each close is a line in the run'sactions, so it appears inGET /api/v1/maintenance/runs. The duty never closes a pull a person opened, a pull a person has commented on, or one assigned to a person. It doesn't touch the release workflow or the chart.What differs from the issue:
src/maintain/duties/, which is how this repository adds duties (per AGENTS.md).src/core/maintenance.tsdoesn't exist andsrc/core/merges.tsdidn't need to change.keep_planorestimatecalls. Those tools weren't available in this run, so the issue has no plan and no time was promised.How it was tested:
test/revert-pulls-duty.test.tssets up a repository whose main hasAdd widget,Add knob,Add gadget,Revert "Add gadget"andAdd dial. It opens three fixture pulls and runs the duty through the real maintenance runner. The green pull stays open and is in the findings. The red pull is closed and its comment names theAdd knobcommit. The already-reverted pull is closed and its comment names the revert's commit. The stored run has exactly those two closes. Three guard pulls stay open: one under a day old, one opened by a person, one with a person's comment. A second pass closes nothing. The test fails without the change because the module doesn't exist.bun scripts/gate.ts --fixrewrapped comments, which are committed.bun x tsc --noEmitis clean, and the 124 test files named byscripts/fast.tspass (1937 tests).To try it: on a preview, sign in as an admin and wait for the duty's run (or open
GET /api/v1/maintenance/runs), then look forrevert-pullsrows.🤖 Generated with Claude Code
Closes #15804