Public: anyone can read this; the crew can change it.
Throughput: Nothing is ready: no pillar has an issue a builder can start. #14744
Check · Review · Land · Live done — Landed and live in production.
mason/forge:mason/14739-throughput-nothing-is-ready-no-pillar-ha → main 2 commits fork
3 files
changed +18
−2
docs/features/keeper.md +1 −1
| @@ -7,7 +7,7 @@ row: The throughput keeper | ||
| 7 | 7 | The forge watches its own landing rate, names the one thing binding it, and acts where the act is reversible and its own. `src/flow/keeper.ts` ticks once a minute. It reads the database and asks no model, so it still speaks when the subscription is out. |
| 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 | 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`). | |
| 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`). `empty_pillar` binds only when no ready issue is held by a run or an open pull: those issues exist, and the pile behind them is named instead (`stale_pile`). | |
| 11 | 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 |
src/flow/keeper_cause.ts +10 −1
| @@ -40,6 +40,11 @@ export interface RepoFacts { | ||
| 40 | 40 | readonly slug: string; |
| 41 | 41 | /** Ready issues a builder could start now. */ |
| 42 | 42 | readonly startable: number; |
| 43 | /** | |
| 44 | * Ready issues already being worked: a run in flight or a pull open. Nothing is missing for | |
| 45 | * these. | |
| 46 | */ | |
| 47 | readonly inFlight?: number; | |
| 43 | 48 | /** Builder runs in flight, and the slots they fill. */ |
| 44 | 49 | readonly running: number; |
| 45 | 50 | readonly slots: number; |
| @@ -102,7 +107,10 @@ export function pickCause(f: KeeperFacts, skip: ReadonlySet<KeeperCause> = new S | ||
| 102 | 107 | } |
| 103 | 108 | } |
| 104 | 109 | const first = f.repos[0]; |
| 105 | if (first && f.repos.every((r) => r.startable === 0)) { | |
| 110 | // Ready issues that wait only on a run or an open pull are not missing: a filed "nothing is | |
| 111 | // ready" would ask a builder for what already exists, and the pile behind them is the cause named | |
| 112 | // below. | |
| 113 | if (first && f.repos.every((r) => r.startable === 0 && (r.inFlight ?? 0) === 0)) { | |
| 106 | 114 | const found = hit({ cause: "empty_pillar", move: "file", repoId: first.repoId, says: "Nothing is ready: no pillar has an issue a builder can start." }); |
| 107 | 115 | if (found) return found; |
| 108 | 116 | } |
| @@ -154,6 +162,7 @@ export function readKeeperFacts(app: App, now: Date): KeeperFacts { | ||
| 154 | 162 | repoId: repo.id, |
| 155 | 163 | slug: `${repo.ownerName}/${repo.name}`, |
| 156 | 164 | startable: held.startable.length, |
| 165 | inFlight: held.by.running.length + held.by.open_pull.length, | |
| 157 | 166 | running: slottedRuns(active, crew).length, |
| 158 | 167 | slots: repo.autonomySlots, |
| 159 | 168 | atCeiling: weekSpent(app, repo, now), |
test/flow-keeper.test.ts +7
| @@ -164,6 +164,13 @@ test("the closed list: the ceiling outranks usage, and a tried cause gives way t | ||
| 164 | 164 | expect(pickCause({ repos: [], red: 6, stale: 0 })).toBeNull(); |
| 165 | 165 | }); |
| 166 | 166 | |
| 167 | test("ready issues held only by a run or an open pull are not an empty pillar: the pile is the cause", () => { | |
| 168 | const idle: RepoFacts = { repoId: "r", slug: "a/b", startable: 0, running: 0, slots: 4, atCeiling: false, noHeadroom: false, resetsAt: null }; | |
| 169 | expect(pickCause({ repos: [idle], red: 0, stale: 0 })?.cause).toBe("empty_pillar"); | |
| 170 | expect(pickCause({ repos: [{ ...idle, inFlight: 5 }], red: 0, stale: 0 })).toBeNull(); | |
| 171 | expect(pickCause({ repos: [{ ...idle, inFlight: 5 }], red: 0, stale: 77 })?.cause).toBe("stale_pile"); | |
| 172 | }); | |
| 173 | ||
| 167 | 174 | test("the scorecard carries hours running and landed per day for a week", () => { |
| 168 | 175 | const card = readScorecards(app, admin); |
| 169 | 176 | expect(card?.keeperDays.length).toBe(7); |
new above
offline