@feigi/fleet-ctl 3.158.7 → 3.158.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feigi/fleet-ctl",
3
- "version": "3.158.7",
3
+ "version": "3.158.8",
4
4
  "description": "Agent fleet: run-team controller, merge bot, PR reviewer, and the ticket pipeline they share",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -35,3 +35,52 @@ export function ownClosingIssues(pr, prUrl, refs) {
35
35
  }
36
36
  return [...numbers];
37
37
  }
38
+
39
+ // A PR's closingIssuesReferences leaves out an issue only a commit message's
40
+ // closing keyword names, yet GitHub closes that issue when the PR merges with
41
+ // a merge commit. This reads those: the issues the messages of `commits` — the
42
+ // `commits` entries `gh pr view --json commits` lists, each with `oid`,
43
+ // `messageHeadline` and `messageBody` — close, in the order their first
44
+ // mention comes in, as `{number, oid}` with `oid` the first commit that names
45
+ // the number. It counts what drop-merged-label.sh's commit scan counts, and a
46
+ // colon after the keyword besides, which GitHub's docs name as closing
47
+ // (`Closes: #N`) and that scan leaves out: per line of the message, a
48
+ // `close`, `closes`, `closed`, `fix`, `fixes`, `fixed`, `resolve`, `resolves`
49
+ // or `resolved` keyword, in any case, with no letter, digit or `_` before it —
50
+ // so `bugfix #N` and `prefix #N` are not keywords — and then an optional `:`,
51
+ // optional whitespace and `#N`. A match never crosses a line: whitespace
52
+ // before `#N` excludes a newline, and a newline is itself a character the
53
+ // keyword may follow, so the message is scanned whole. A letter or digit is
54
+ // one in Unicode's sense; the scan's `[:alnum:]` agrees under a UTF-8 locale,
55
+ // but under `C` a non-ASCII letter is none, so there the scan finds #5 in
56
+ // `éfix #5` and this one does not. A bare `#N`, `Refs #N`, a keyword before
57
+ // `owner/repo#N` or a URL is not a match.
58
+ // The message is the headline, a newline and the body, but gh cuts a long
59
+ // headline short with `…` and opens the body with `…` and the headline's rest,
60
+ // so a headline ending in `…` and a body starting with one are joined back
61
+ // into the one line they were. Throws an Error whose message names what could
62
+ // not be read, phrased to follow the read's own "answered": `no list of
63
+ // commits`, `a commit with no oid`, `commit <oid> with no message`.
64
+ const COMMIT_CLOSE = /(?:^|[^\p{L}\p{N}_])(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?):?[ \t\r\v\f]*#([0-9]+)/giu;
65
+
66
+ export function commitClosingIssues(commits) {
67
+ if (!Array.isArray(commits)) throw new Error("no list of commits");
68
+ const first = new Map();
69
+ for (const c of commits) {
70
+ if (typeof c?.oid !== "string" || c.oid === "") throw new Error("a commit with no oid");
71
+ const body = c.messageBody ?? "";
72
+ if (typeof c.messageHeadline !== "string" || typeof body !== "string") throw new Error(`commit ${c.oid} with no message`);
73
+ const cut = c.messageHeadline.endsWith("…") && body.startsWith("…");
74
+ const message = cut ? `${c.messageHeadline.slice(0, -1)}${body.slice(1)}` : `${c.messageHeadline}\n${body}`;
75
+ for (const m of message.matchAll(COMMIT_CLOSE)) {
76
+ const number = Number(m[1]);
77
+ if (Number.isSafeInteger(number) && !first.has(number)) first.set(number, c.oid);
78
+ }
79
+ }
80
+ return [...first].map(([number, oid]) => ({ number, oid }));
81
+ }
82
+
83
+ // The most commits `gh pr view --json commits` lists: it answers the first
84
+ // COMMITS_LIMIT of a PR's commits and no count of the rest, so an answer of
85
+ // that many may be cut off, and a commit it does not hold was not read.
86
+ export const COMMITS_LIMIT = 100;
@@ -81,7 +81,7 @@ import { processSource, ancestry, controllerOf, judgeController, ProcUnreadable
81
81
  import { attemptLock, releaseLockFile, reapPathOf } from "./pid-lock.mjs";
82
82
  import { readCheckRecordIn, readReportIn, reportsDir, reportFamily, defaultScratch, reportPath } from "./report-files.mjs";
83
83
  import { mergeBotVerdicts } from "./report-schema.mjs";
84
- import { ownClosingIssues } from "./closing-refs.mjs";
84
+ import { ownClosingIssues, commitClosingIssues, COMMITS_LIMIT } from "./closing-refs.mjs";
85
85
  import { isTicketless } from "./ticketless.mjs";
86
86
  import { RELEASE_LABELS, LABEL_LIST_ARGS, LABEL_LIST_LIMIT, releaseLabelsIn, releaseLabelsDefined } from "./release-labels.mjs";
87
87
  import { LabelMapUnreadable, readLabelMap } from "./label-map.mjs";
@@ -2094,10 +2094,19 @@ function checkReaders(where) {
2094
2094
  return r;
2095
2095
  };
2096
2096
  const verifyShaOf = (branch, sha) => look(`verify-sha.sh ${branch} ${sha}`, "sh", [verifySha, branch, sha], [0, 1]);
2097
+ // gh's answer, at exit 1, for a number no issue or PR in the repository has.
2098
+ const NO_ISSUE = /Could not resolve to an issue or pull request with the number of /;
2097
2099
  // A gh answer, parsed: `v` the JSON it printed, or null when it printed
2098
- // none, beside the answer `r` itself for the caller's refusal.
2099
- const lookJson = (what, args, lead = "could not look") => {
2100
- const r = look(what, "gh", args, [0], lead);
2100
+ // none, beside the answer `r` itself for the caller's refusal. With
2101
+ // `orNone`, gh answering that no issue or PR has the number asked for is
2102
+ // null in place of an answer; any other exit 1 still could not look.
2103
+ const lookJson = (what, args, lead = "could not look", orNone = false) => {
2104
+ const r = look(what, "gh", args, orNone ? [0, 1] : [0], lead);
2105
+ if (r.status === 1) {
2106
+ if (NO_ISSUE.test(r.stderr)) return null;
2107
+ const why = cause(r.stderr);
2108
+ die(`${where}: ${lead} — ${what} exited 1${why ? `: ${why}` : ""}; nothing written`);
2109
+ }
2101
2110
  try {
2102
2111
  return { r, v: JSON.parse(r.stdout) };
2103
2112
  } catch {
@@ -2133,6 +2142,26 @@ function checkReaders(where) {
2133
2142
  die(`${where}: could not look — gh pr view ${pr} --json ${fields} answered ${e.message}; nothing written`);
2134
2143
  }
2135
2144
  };
2145
+ // PR `pr`'s commit-borne closing references, `{number, oid}` as
2146
+ // commitClosingIssues() reads them off `gh pr view --json commits`. An
2147
+ // answer that is no list of commits, that fills gh's cap on the commits it
2148
+ // lists — the rest were not read — or that commitClosingIssues() cannot
2149
+ // read could not look.
2150
+ const prCommitClosing = (pr) => {
2151
+ const what = `gh pr view ${pr} --json commits`;
2152
+ const { r, v } = lookJson(what, ["pr", "view", String(pr), "--json", "commits"]);
2153
+ if (!Array.isArray(v?.commits)) {
2154
+ die(`${where}: could not look — ${what} printed no list of commits: ${cause(r.stdout)}; nothing written`);
2155
+ }
2156
+ if (v.commits.length >= COMMITS_LIMIT) {
2157
+ die(`${where}: could not look — ${what} answered ${COMMITS_LIMIT} or more commits, so the list may be cut off; nothing written`);
2158
+ }
2159
+ try {
2160
+ return commitClosingIssues(v.commits);
2161
+ } catch (e) {
2162
+ die(`${where}: could not look — ${what} answered ${e.message}; nothing written`);
2163
+ }
2164
+ };
2136
2165
  // `labels` as the list of the label names it holds, or null when it is
2137
2166
  // anything but a list of named labels.
2138
2167
  const namedLabels = (labels) => {
@@ -2141,10 +2170,13 @@ function checkReaders(where) {
2141
2170
  };
2142
2171
  // Issue `n`'s title and label names, as `gh issue view <n> --json
2143
2172
  // title,labels` answers them. An answer without a string title, or without a
2144
- // list of named labels, could not look.
2145
- const issueRead = (n) => {
2173
+ // list of named labels, could not look. With `orNone`, null when no issue or
2174
+ // PR has the number (lookJson()).
2175
+ const issueRead = (n, orNone = false) => {
2146
2176
  const what = `gh issue view ${n} --json title,labels`;
2147
- const { r, v } = lookJson(what, ["issue", "view", String(n), "--json", "title,labels"]);
2177
+ const read = lookJson(what, ["issue", "view", String(n), "--json", "title,labels"], "could not look", orNone);
2178
+ if (read === null) return null;
2179
+ const { r, v } = read;
2148
2180
  if (v === null || typeof v !== "object" || typeof v.title !== "string") {
2149
2181
  die(`${where}: could not look — ${what} printed no title: ${cause(r.stdout)}; nothing written`);
2150
2182
  }
@@ -2156,11 +2188,14 @@ function checkReaders(where) {
2156
2188
  };
2157
2189
  // The label names gh answers `args` with, `list` taking the label list off
2158
2190
  // the parsed answer. A read that fails, or answers anything but a list of
2159
- // named labels, could not read `whose` labels.
2160
- const labelNames = (whose, args, list) => {
2191
+ // named labels, could not read `whose` labels. With `orNone`, null when no
2192
+ // issue or PR has the number asked for (lookJson()).
2193
+ const labelNames = (whose, args, list, orNone = false) => {
2161
2194
  const what = `gh ${args.join(" ")}`;
2162
2195
  const lead = `could not read ${whose} labels`;
2163
- const { r, v } = lookJson(what, args, lead);
2196
+ const read = lookJson(what, args, lead, orNone);
2197
+ if (read === null) return null;
2198
+ const { r, v } = read;
2164
2199
  const labels = namedLabels(list(v));
2165
2200
  if (labels === null) {
2166
2201
  die(`${where}: ${lead} — ${what} printed no list of named labels: ${cause(r.stdout)}; nothing written`);
@@ -2170,8 +2205,9 @@ function checkReaders(where) {
2170
2205
  // PR `pr`'s label names, and the names of the labels its repository defines.
2171
2206
  const prLabels = (pr) => labelNames(`PR #${pr}'s`, ["pr", "view", String(pr), "--json", "labels"], (v) => v?.labels);
2172
2207
  const repoLabels = () => labelNames("the repository's", LABEL_LIST_ARGS, (v) => v);
2173
- // Issue `n`'s label names, as `gh issue view <n> --json labels` answers them.
2174
- const issueLabels = (n) => labelNames(`issue #${n}'s`, ["issue", "view", String(n), "--json", "labels"], (v) => v?.labels);
2208
+ // Issue `n`'s label names, as `gh issue view <n> --json labels` answers
2209
+ // them; with `orNone`, null when no issue or PR has number `n`.
2210
+ const issueLabels = (n, orNone = false) => labelNames(`issue #${n}'s`, ["issue", "view", String(n), "--json", "labels"], (v) => v?.labels, orNone);
2175
2211
  // Of `numbers`, a PR's closing references in its own repository, those not
2176
2212
  // in `own` — the PR's own tickets — whose issue carries the in-progress Label
2177
2213
  // role's string: tickets another claim holds. `labelsOf(n)` is issue n's
@@ -2183,7 +2219,7 @@ function checkReaders(where) {
2183
2219
  const inProgress = roleLabel(repoDir(), "in-progress", where);
2184
2220
  return others.filter((n) => labelsOf(n).includes(inProgress));
2185
2221
  };
2186
- return { repoDir, look, verifyShaOf, prView, prViewClosing, issueRead, prLabels, repoLabels, issueLabels, claimedElsewhere };
2222
+ return { repoDir, look, verifyShaOf, prView, prViewClosing, prCommitClosing, issueRead, prLabels, repoLabels, issueLabels, claimedElsewhere };
2187
2223
  }
2188
2224
 
2189
2225
  // The finisher gate's closing-reference checks for the PR `member` finishes,
@@ -2198,7 +2234,12 @@ function checkReaders(where) {
2198
2234
  // issue whose title, trimmed, is recordTitle(), as dispositions-check.mjs
2199
2235
  // finds the record. Check 3, for every PR, Ticketless ones included: no
2200
2236
  // reference besides the PR's own tickets may be a ticket another claim holds,
2201
- // its issue carrying the Label map's in-progress string (claimedElsewhere()).
2237
+ // its issue carrying the Label map's in-progress string (claimedElsewhere()) —
2238
+ // and so may no issue a commit message of the PR closes by a closing keyword
2239
+ // (closing-refs.mjs's commitClosingIssues()), which closingIssuesReferences
2240
+ // leaves out and a merge commit closes all the same. A commit-borne number
2241
+ // counts toward this check only: not check 1, check 2, the Ticketless test or
2242
+ // the `refs` returned, and one the body already closes was judged by the body.
2202
2243
  // The PR's own tickets are the ones its settled tokens name and, when its
2203
2244
  // head is a claim branch (stranded.mjs's CLAIM_BRANCH), that claim's ticket —
2204
2245
  // a PR a run inherited carries no token, and its own claim holds its ticket
@@ -2211,7 +2252,7 @@ async function closingRefusals(member, tickets) {
2211
2252
  const where = `dispatch ${member.name}`;
2212
2253
  const { recordTitle } = await import("./dispositions-check.mjs");
2213
2254
  const { CLAIM_BRANCH } = await import("./stranded.mjs");
2214
- const { prViewClosing, issueRead, claimedElsewhere } = checkReaders(where);
2255
+ const { prViewClosing, prCommitClosing, issueRead, claimedElsewhere } = checkReaders(where);
2215
2256
  const { view, numbers: refs } = prViewClosing(pr, "closingIssuesReferences,url,headRefName");
2216
2257
  const claim = CLAIM_BRANCH.exec(view.headRefName);
2217
2258
  const ownTickets = [...new Set(claim === null ? tickets : [...tickets, Number(claim[1])])];
@@ -2234,6 +2275,17 @@ async function closingRefusals(member, tickets) {
2234
2275
  for (const n of claimedElsewhere(closed, ownTickets, (m) => labels.get(m))) {
2235
2276
  failures.push(`PR #${pr} closes #${n}, which another claim holds — rephrase it as "Refs #${n}"`);
2236
2277
  }
2278
+ // A closing keyword in a commit message closes its issue at merge too,
2279
+ // though closingIssuesReferences leaves it out. Check 3 only: it neither
2280
+ // makes the PR close a ticket nor takes one from it. A number the body
2281
+ // already closes was judged above. A number no issue or PR has — a typo, or
2282
+ // another repository's number a cherry-pick carried — closes nothing, so no
2283
+ // claim holds it.
2284
+ const byCommit = prCommitClosing(pr).filter((c) => !refs.includes(c.number));
2285
+ const held = claimedElsewhere(byCommit.map((c) => c.number), ownTickets, (m) => issueRead(m, true)?.labels ?? []);
2286
+ for (const c of byCommit.filter((c) => held.includes(c.number))) {
2287
+ failures.push(`PR #${pr}'s commit ${c.oid.slice(0, 7)} closes #${c.number}, which another claim holds — that commit must be reworded to "Refs #${c.number}"`);
2288
+ }
2237
2289
  return { refs: closed, failures };
2238
2290
  }
2239
2291
 
@@ -2774,7 +2826,11 @@ function recordFiled(id, subject) {
2774
2826
  // reads OPEN and its closingIssuesReferences in its
2775
2827
  // own repository name N; no other closing
2776
2828
  // reference there is a ticket another claim holds,
2777
- // its issue carrying in-progress; its head branch
2829
+ // its issue carrying in-progress, and no issue a
2830
+ // commit message of PR M closes by a closing
2831
+ // keyword is one either — commits read by gh pr
2832
+ // view --json commits, a list that fills gh's cap
2833
+ // on it could not look (exit 2); its head branch
2778
2834
  // is implementer/N-impl-N. Last, and only when
2779
2835
  // every other check passed: verify-sha.sh <branch>
2780
2836
  // <head> exits 0, and the Check-step record
@@ -2912,7 +2968,7 @@ async function runSettleFromReport() {
2912
2968
  if (report.member !== member) invalid(`$.member: ${JSON.stringify(report.member)} is not ${member}`);
2913
2969
 
2914
2970
  // The gh and git reads this check makes, shared with the finisher gate.
2915
- const { repoDir, look, verifyShaOf, prView, prViewClosing, issueLabels, claimedElsewhere } = checkReaders(where);
2971
+ const { repoDir, look, verifyShaOf, prView, prViewClosing, prCommitClosing, issueLabels, claimedElsewhere } = checkReaders(where);
2916
2972
  // origin's head of `branch`, or null when origin has no such branch.
2917
2973
  const remoteHead = (branch) => {
2918
2974
  const ref = `refs/heads/${branch}`;
@@ -2979,11 +3035,21 @@ async function runSettleFromReport() {
2979
3035
  // The claim's own ticket is the token's: a replacement impl-N-x holds
2980
3036
  // the same claim as impl-N, so it is never refused for #N. A PR that is
2981
3037
  // not OPEN, or does not close #N, has failed already, so no other
2982
- // reference's issue is read: a read that could not look would turn
2983
- // that exit 3 into exit 2.
3038
+ // reference's issue and none of its commits is read: a read that could
3039
+ // not look would turn that exit 3 into exit 2.
2984
3040
  if (pr.state === "OPEN" && numbers.includes(live.number)) {
2985
3041
  const held = claimedElsewhere(numbers, [live.number], issueLabels);
2986
3042
  check(`PR #${report.pr} closes no ticket another claim holds (in-progress: ${held.length === 0 ? "none" : held.map((n) => `#${n}`).join(", ")})`, held.length === 0);
3043
+ // A closing keyword in a commit message closes its issue at merge as
3044
+ // well, though closingIssuesReferences leaves it out. Only a refusal
3045
+ // is a check: a number the body already closes was judged above, a
3046
+ // number no issue or PR has closes nothing, and a PR whose commits
3047
+ // close nothing else has no line to add.
3048
+ const byCommit = prCommitClosing(report.pr).filter((c) => !numbers.includes(c.number));
3049
+ const heldByCommit = claimedElsewhere(byCommit.map((c) => c.number), [live.number], (n) => issueLabels(n, true) ?? []);
3050
+ for (const c of byCommit.filter((c) => heldByCommit.includes(c.number))) {
3051
+ check(`PR #${report.pr}'s commit ${c.oid.slice(0, 7)} closes #${c.number}, which another claim holds (in-progress) — reword that commit to "Refs #${c.number}"`, false);
3052
+ }
2987
3053
  }
2988
3054
  check(`PR #${report.pr}'s head is ${claimBranch} (GitHub: ${pr.headRefName})`, pr.headRefName === claimBranch);
2989
3055
  // git is read last, and only once every check above has passed: a
@@ -182,7 +182,7 @@ above is the correct one.
182
182
 
183
183
  `Closes #N` closes issue on merge — as does any closing keyword (`close`, `fixes`, `resolved`, …) sitting directly before an issue reference, wherever it appears in the body. Write one `Closes #M` per issue you mean to close, so `Closes #A, closes #B` closes both; give every other issue mention a word in front of it — `closed issue #M`, or the issue named without the `#`. A keyword before a list links only the first reference in that list, never the rest: `Closes #A, #B` closes only issue A.
184
184
 
185
- Close no ticket another claim holds — its issue carries the in-progress label — even when the ticket asks for one PR with it; write `Refs #M`. A ticket closed by another claim's PR strands that claim: neither release nor reap removes it.
185
+ Close no ticket another claim holds — its issue carries the in-progress label — even when the ticket asks for one PR with it, in the PR body or in a commit message; write `Refs #M`. A ticket closed by another claim's PR strands that claim: neither release nor reap removes it.
186
186
 
187
187
  Repo gating on release label → exactly one of `patch`/`minor`/`major`; `validate-release-label` fails without it.
188
188
 
@@ -561,8 +561,8 @@ Dispatch a finisher only when every test here passes at once — the review retu
561
561
  **This bullet and the one above are a pair, and on a clean PR this one carries the
562
562
  whole route to a finisher**: a `no-op` report satisfies the gate above by
563
563
  itself, so nothing further is owed and no further event is coming.
564
- - **The PR closes its own tickets, and no closing reference is its own suggestion-band record or a ticket another claim holds** → `ledger.mjs dispatch` refuses the finisher otherwise, naming the PR and ticket: `gh pr edit <M>` fixes the body; dispatch again.
565
- - **The PR carries exactly one release label, or its repo defines none** → `ledger.mjs dispatch` refuses the finisher otherwise, except a Ticketless PR with none, which `finisher-label.mjs` labels `patch`. Fix them; dispatch again. In full: references/finisher.md.
564
+ - **The PR closes its own tickets; no closing reference is its own suggestion-band record or another claim's ticket** → `ledger.mjs dispatch` refuses otherwise, naming PR and ticket: `gh pr edit <M>` fixes the body (a named commit: report it, no retry); dispatch again.
565
+ - **The PR carries exactly one release label, or its repo defines none** → `ledger.mjs dispatch` refuses otherwise, except a Ticketless PR with none, which `finisher-label.mjs` labels `patch`. Fix them; dispatch again. In full: references/finisher.md.
566
566
  - **`ci-state.mjs --pr <N>` reads `verdict: "no-ci"`** → the CI edge never
567
567
  fires: dispatch the finisher off the reviewer's final verdict the moment it
568
568
  lands, never while you still owe it a reply. Its gate is then the
@@ -18,8 +18,8 @@ one. If the ticket names one, say in the PR body that you used `<branch>`. Label
18
18
  in this file are roles; the Label map gives the string to type; a member never derives
19
19
  the map. Close no ticket
20
20
  another claim holds — one whose issue carries the in-progress label — even when the
21
- ticket below asks for one PR with it: write `Refs #M` instead; the settle refuses a PR
22
- that closes one. Your scratch directory is `<scratch>/impl-<N>/`; outside the worktree,
21
+ ticket below asks for one PR with it, in the PR body or in a commit message: write
22
+ `Refs #M` instead; the settle refuses a PR that closes one. Your scratch directory is `<scratch>/impl-<N>/`; outside the worktree,
23
23
  write nowhere else but your report file below.
24
24
 
25
25
  The ticket, pasted verbatim from the controller's own read — its title, the
@@ -120,6 +120,7 @@ and will act on it. Relay everything — reversals too — then dispatch.
120
120
  is never held once the first passed; a PR no such token names is not gated.
121
121
  No flag skips it: a PR `append` refuses is fixed on the ledger, as at close-out.
122
122
  - **The PR closes its own tickets, and no closing reference is its own suggestion-band record or a ticket another claim holds** → `ledger.mjs dispatch` reads the PR's `closingIssuesReferences` from `gh pr view <M>` before it dispatches any finisher, counting only those in the PR's own repository: a reference into another repository closes none of this repository's tickets, whatever its number. Each of the PR's own tickets must be closed by the body (`Closes #<N>`): the tickets a settled `impl-<N>=PR#<M>` token names, and, when the PR's head is a claim branch (`implementer/<N>-impl-<N>[-<x>]`), that claim's ticket — so a PR a run inherited, which carries no token, is held to it too. The ruling does not decide this: it judges the work as first submitted, and a finding the fix-applier defers is filed on an issue of its own, so an implementer PR closes its own ticket whatever its ruling. No reference may be the PR's own suggestion-band record. For every PR, a Ticketless one too, no reference besides its own tickets may be one another claim holds — one whose issue carries the in-progress label, as the Label map spells it; the same `gh issue view` read of each reference answers it. A refusal names the PR and the ticket, and for a ticket another claim holds says to write `Refs #<M>`. The controller repairs the body itself with `gh pr edit <M> --body-file <file>`, then dispatches the finisher again. A `gh` read that fails refuses the dispatch and writes nothing.
123
+ The same holds for an issue a commit message of the PR closes with a closing keyword: `closingIssuesReferences` leaves it out, yet a merge commit closes it. `ledger.mjs dispatch` reads the PR's commits too (`gh pr view <M> --json commits`), and a commit that closes a ticket another claim holds refuses the dispatch, naming the PR, the ticket and the commit. That refusal counts toward this check only — a commit never makes the PR close its own ticket, nor stops it being Ticketless — and it is fixed by rewording that commit to `Refs #<M>`, which `gh pr edit` cannot do and no member does: the controller does not retry, and reports the refusal to the maintainer. A list of commits that may be cut off — `gh` lists a PR's first 100 commits and no count of the rest — is a read that could not look: the dispatch is refused and nothing is written.
123
124
  - **The PR carries exactly one release label** → `ledger.mjs dispatch` reads the PR's labels from `gh pr view <M>` before it dispatches any finisher, and refuses unless exactly one of `patch`, `minor` and `major` is among them — the count `finisher-label.mjs` makes before it labels. A repository whose label list defines none of the three is not gated. A Ticketless PR with none is not refused: `finisher-label.mjs` adds `patch` to it before its count. Any other PR with none is refused naming the tickets it closes, and any PR with several naming the labels found — the bump, or which label stays, is not picked for the controller. The controller adds or removes the label itself, then dispatches the finisher again. A `gh` read that fails or answers malformed refuses the dispatch, saying the labels could not be read, and writes nothing.
124
125
  - **The PR carries no `ready-to-merge`** → the same `gh pr view <M>` read of the PR's labels answers it, and `ledger.mjs dispatch` refuses any finisher while the label is on, writing nothing and naming `fleet-event.mjs label-off <M>`. A finisher runs on an unlabelled PR: the label a merge bot's `head-moved-after-label` refusal left comes off with its report's settle, and the command takes off any other. A repair finisher's PR lacks the label by definition, so it passes.
125
126