Public: anyone can read this; the crew can change it.
Throughput: 87 open crew pulls are waiting on a builder or a reviewer. #14699
Check · Review · Land · Live done — Landed and live in production.
torque/forge:torque/14612-throughput-87-open-crew-pulls-are-waitin → main 1 commit fork
3 files
changed +26
−3
docs/features/keeper.md +1 −1
| @@ -8,7 +8,7 @@ The forge watches its own landing rate, names the one thing binding it, and acts | ||
| 8 | 8 | |
| 9 | 9 | 1. **Measure** (`keeper_rate.ts`): pulls landed per hour over the last 3 h against the best 3 h rate of the week before, and the share of the last 24 hours that ran (a landing or a builder run started). Low is under half the best and under one an hour. |
| 10 | 10 | 2. **Find** (`keeper_cause.ts`): the first of `ceiling`, `usage` ("resets at HH:MM UTC"), `unassigned`, `empty_pillar`, `stale_reds`, `red_checks`, `stale_pile`, `capacity`. It asks the dispatcher's own questions (`heldNow`, `atCeiling`, `pace`). |
| 11 | 3. **Act**: `unassigned` sweeps assigned issues with no run. `empty_pillar`, `red_checks` and `stale_pile` become one filed issue in the forge's own repository, once a week per cause (`stale_pile`'s issue lists the ten oldest waiting pulls, red and conflicted ones left out, each with what it waits on: a reviewer, a builder or the merge). `ceiling`, `usage`, `capacity` and `stale_reds` (the crew's red-pull sweep is already at it) are only said. | |
| 11 | 3. **Act**: `unassigned` sweeps assigned issues with no run. `empty_pillar`, `red_checks` and `stale_pile` become one filed issue in the forge's own repository, once a week per cause (`stale_pile`'s issue lists the ten oldest pulls waiting on a reviewer or a builder, red and conflicted ones left out, and only counts those waiting on the merge, which is a person's act). `ceiling`, `usage`, `capacity` and `stale_reds` (the crew's red-pull sweep is already at it) are only said. | |
| 12 | 12 | 4. **Check** after 2 h: landings rose and the act stands, or it is undone, the cause is left alone for 6 h and the owner is asked one question with one button (`POST /flow/keeper/answer`). |
| 13 | 13 | |
| 14 | 14 | Where it shows: one line on home and on the boards panel, `keeper` in the MCP `flow` report, the terminal's Flow dialog (the line, the question, and `l` for its one button after a confirm) and its crew scorecard ("Forge per day" rows), and "Forge per day" (hours running, landed) on the crew scorecard and in `scorecard` (`keeperDays`). Every attempt is a row in `keeper_attempt`. |
src/flow/keeper.ts +9 −2
| @@ -125,8 +125,15 @@ export function fileOnce(app: App, found: { cause: KeeperCause; says: string }, | ||
| 125 | 125 | const [owner, name] = ownRepoPath().split("/"); |
| 126 | 126 | const repo = owner && name ? getRepo(app.db, owner, name) : undefined; |
| 127 | 127 | if (!repo) return log.warn("keeper cannot file: the forge's own repository is missing", { path: ownRepoPath() }); |
| 128 | const oldest = found.cause === "stale_pile" ? oldestWaitingOn(app.db, 10, repo.visibility !== "private") : []; | |
| 129 | const list = oldest.length === 0 ? "" : `\n\nOldest waiting, start here:\n${oldest.map((s) => `- ${s.ref} (waits on ${s.on})`).join("\n")}`; | |
| 128 | // A pull waiting on the merge is a person's act, not a builder's or a reviewer's: it is counted, | |
| 129 | // not listed. | |
| 130 | const waiting = found.cause === "stale_pile" ? oldestWaitingOn(app.db, Number.MAX_SAFE_INTEGER, repo.visibility !== "private") : []; | |
| 131 | const oldest = waiting.filter((s) => s.on !== "the merge").slice(0, 10); | |
| 132 | const onMerge = waiting.length - waiting.filter((s) => s.on !== "the merge").length; | |
| 133 | const list = | |
| 134 | waiting.length === 0 | |
| 135 | ? "" | |
| 136 | : `${oldest.length === 0 ? "" : `\n\nOldest waiting, start here:\n${oldest.map((s) => `- ${s.ref} (waits on ${s.on})`).join("\n")}`}${onMerge === 0 ? "" : `\n\n${onMerge} more ${onMerge === 1 ? "waits" : "wait"} on the merge, a person's act, and ${onMerge === 1 ? "is" : "are"} not listed.`}`; | |
| 130 | 137 | const reds = found.cause === "red_checks" ? redPulls(app.db, 10, repo.visibility !== "private") : []; |
| 131 | 138 | const redList = reds.length === 0 ? "" : `\n\nRed, oldest first, start here:\n${reds.map((r) => `- ${r}`).join("\n")}`; |
| 132 | 139 | const held = found.cause === "empty_pillar" ? heldNow(app, repo) : undefined; |
test/flow-pile-oldest.test.ts +16
| @@ -144,3 +144,19 @@ test("the filed red_checks issue names the red pulls, oldest first", () => { | ||
| 144 | 144 | else process.env.FORGE_SENTINEL_REPO = was; |
| 145 | 145 | } |
| 146 | 146 | }); |
| 147 | ||
| 148 | test("the filed stale_pile issue counts pulls waiting on the merge and does not list them", () => { | |
| 149 | const was = process.env.FORGE_SENTINEL_REPO; | |
| 150 | process.env.FORGE_SENTINEL_REPO = "trevato/open"; | |
| 151 | try { | |
| 152 | const issue = app.db.query<{ id: string }, []>("SELECT i.id FROM issue i JOIN repo r ON r.id = i.repo_id WHERE r.name = 'open' AND i.number = 4").get()!.id; | |
| 153 | app.db.query(`INSERT INTO review (id, issue_id, author_id, state, body, created_at) VALUES ('rv5', ?1, ?2, 'approved', '', '2026-11-06T00:00:00.000Z')`).run(issue, agent); | |
| 154 | fileOnce(app, { cause: "stale_pile", says: "Open crew pulls wait." }, { lastHour: 0, recent: 0.5, best: 3, ranShare: 1 }, Date.now()); | |
| 155 | const b = app.db.query<{ body: string }, []>("SELECT body FROM issue WHERE title LIKE 'Throughput:%' ORDER BY created_at DESC, rowid DESC LIMIT 1").get()!.body; | |
| 156 | expect(b).not.toContain("open#4"); | |
| 157 | expect(b).toContain("1 more waits on the merge, a person's act, and is not listed."); | |
| 158 | } finally { | |
| 159 | if (was === undefined) delete process.env.FORGE_SENTINEL_REPO; | |
| 160 | else process.env.FORGE_SENTINEL_REPO = was; | |
| 161 | } | |
| 162 | }); |
new above
offline