Skip to content
Open
7 changes: 7 additions & 0 deletions .changes/pr-pipeline/fix-pr-verify-cap-head-fail-d4570a1c.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
bump: patch
---

### Fixed

- pr-verify's repeated-fail cap (`merge.max-verify-fails`, `verify:repeated-fail`) closes a pull request only when its current head itself has a FAIL that is not superseded (owner decision Q245, [#17646](https://github.com/melodic-software/claude-code-plugins/issues/17646)). FAILs at superseded heads no longer close it: a pass at the head goes on to the normal pass decision. pr-merge's `capped_close` and pr-unblock's `verify-cap.mjs` read the same reader, so both follow it; the README's Verifier verdict section, the schema and `pr-pipeline.yaml` say so. pr-unblock's address-feedback and fix-ci dispatchers no longer record a capped head as handled, so a head whose FAIL a later pass supersedes is dispatched again; the dispatch record's version is 7, so heads an earlier version recorded at the cap are read again.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
bump: patch
---

### Fixed

- `babysit_verify_evidence.py` refuses `verify:repeated-fail` only when a counted FAIL that is not superseded stands at the vetted head and FAILs sit at `merge.max-verify-fails` or more heads, that one included (owner decision Q245, [#17646](https://github.com/melodic-software/claude-code-plugins/issues/17646)). A head whose newest verdicts pass, or whose own FAIL is superseded, goes on to the `verify:earlier-fail` or pass decision, whatever FAILs sit at earlier heads or on other pull requests for its issues. Before, FAILs at superseded heads kept counting, so the pr-merge lane closed a pull request whose current head had passed. Counting across other pull requests, the capped-close floor, draft-judged exclusions and `verify:fail` at the head are unchanged.
4 changes: 2 additions & 2 deletions .github/scripts/pr-merge/enable-auto-merge.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
// untrusted work in any spelling and none ever removed by a non-human, so
// one added after admission refuses for a person
// (`untrusted-provenance`). Then a pr-verify PASS or PASS-NOTES stands at that head, no FAIL is
// at it, no earlier FAIL is uncleared, FAILs sit at fewer than
// merge.max-verify-fails heads, and the spec is unchanged and trusted. A
// at it, no earlier FAIL is uncleared, and the spec is unchanged and
// trusted. A
// read that fails, or a line without the link's answer, refuses. Only the
// scheduled run and
// a hand-started one read them (READER_EVENTS), last, for a pull request
Expand Down
6 changes: 4 additions & 2 deletions .github/scripts/pr-unblock/dispatch-record.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ export async function sendDispatch(api, log, { workflow, base, node, inputs, lab
// version 5 a resolve-conflicts head a select job's stop left under an older
// base, and version 6 a resolve-conflicts, sync-shared-copies or
// review-dependency head a head-lag stop left (limit-stop.mjs
// lagStopsRelease). A fix-ci
// lagStopsRelease), and version 7 an address-feedback or fix-ci head
// pr-verify's FAIL cap held, which a superseded FAIL now clears
// (https://github.com/melodic-software/claude-code-plugins/issues/17646). A fix-ci
// head recorded at its per-head cap needs no new version: a record with no
// fix-ci entry reads the same either way; nor do fix-docs runs, read as none.
export const RECORD_VERSION = 6;
export const RECORD_VERSION = 7;
// The fix-docs runs kept per head, newest last: the reader drops the settled
// runs that do not count, so more than this many is a tampered entry.
const MAX_DOCS_RUNS = 20;
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/pr-unblock/dispatch.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1480,13 +1480,13 @@ test("main carries the record in DISPATCH_RECORD and writes it only when it chan
DISPATCH_RECORD: path,
};
// A recorded head no open PR carries any more is dropped.
writeFileSync(path, JSON.stringify({ version: 6, handled: { [CHECK_NAME]: ["f".repeat(40)] }, bases: { ["f".repeat(40)]: "b".repeat(40) }, dispatched: {} }));
writeFileSync(path, JSON.stringify({ version: 7, handled: { [CHECK_NAME]: ["f".repeat(40)] }, bases: { ["f".repeat(40)]: "b".repeat(40) }, dispatched: {} }));
const options = () => ({ api: fakeApi({ pages: [[pr(1)]], checked: new Set([pr(1).headRefOid]) }), sleep: async () => {}, log: () => {}, loadLimits: async () => LIMIT_DEFAULTS, loadAdoption: async () => ({}), loadOwnedBranches: async () => [] });
try {
writeFileSync(output, "");
assert.equal(await main(env, options()), 0);
assert.equal(readFileSync(output, "utf8"), "listed=true\nrecord-changed=true\n");
assert.deepEqual(JSON.parse(readFileSync(path, "utf8")), { version: 6, handled: { [CHECK_NAME]: [pr(1).headRefOid] }, bases: {}, dispatched: {}, docsRuns: {} });
assert.deepEqual(JSON.parse(readFileSync(path, "utf8")), { version: 7, handled: { [CHECK_NAME]: [pr(1).headRefOid] }, bases: {}, dispatched: {}, docsRuns: {} });
writeFileSync(output, "");
assert.equal(await main(env, options()), 0);
assert.equal(readFileSync(output, "utf8"), "listed=true\n");
Expand Down
11 changes: 4 additions & 7 deletions .github/scripts/pr-unblock/feedback-dispatch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,10 @@ export async function dispatchFeedback({
}
}
// Last, as it costs a full verifier read, and on a pass-only dispatch too: a
// later pass clears no cap, and a push past it could never merge, so
// pr-merge closes the pull request for a fresh attempt. It closes only the
// pass clears the cap only by superseding the head's FAIL
// (https://github.com/melodic-software/claude-code-plugins/issues/17646),
// and a push past it could never merge, so pr-merge closes the pull request
// for a fresh attempt. It closes only the
// lanes App's: an adopted owner's is never skipped. A pass-only round skips
// only on a cap the reader found: it only resolves notes a pass superseded,
// and nothing sends it again, so a cap that could not be read (#11354)
Expand Down Expand Up @@ -777,11 +779,6 @@ export async function dispatchFeedback({
return skip(`#${number} has no unresolved review thread, and the verifier read for an earlier FAIL ${readFailed ? "failed" : `could not count every FAIL (${capped})`}; a later pass inside the retry window reads it again`);
}
if (capped) {
// The cap never clears for the head: later runs skip it before any
// read. A sibling read that failed is read again next run.
if (capFinal(capped)) {
markHandled(record, settings.checkName, head);
}
const warning = deadlineWarning(number, capped);
if (warning) {
log(warning);
Expand Down
27 changes: 14 additions & 13 deletions .github/scripts/pr-unblock/feedback-dispatch.test.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// test-scope: .github/actions/resolve-config/package.json
import assert from "node:assert/strict";
import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { join } from "node:path";
Expand Down Expand Up @@ -218,10 +219,6 @@ const pull = (overrides) => [
},
];

// Owner decision 2026-10-29: pr-verify's FAILs at the cap never clear for the
// pull request, so a fix round's push could never merge: the gate's reader
// (verify-cap.mjs) says so, the dispatcher starts no round and posts nothing,
// and pr-merge closes it for a fresh attempt.
test("a PR whose pr-verify FAILs are at the cap gets no address-feedback round", async () => {
const api = fakeApi();
const asked = [];
Expand All @@ -234,13 +231,20 @@ test("a PR whose pr-verify FAILs are at the cap gets no address-feedback round",
assert.deepEqual(api.calls.dispatch, []);
assert.deepEqual(asked, [{ number: 42, head: HEAD, base: "b".repeat(40), expected: [] }]);
assert.match(lines.join("\n"), /^skip: #42: .*verify:repeated-fail/m);
// The cap never clears for the head: a later run at it reads nothing.
});

test("a capped head whose FAIL a later pass superseded is read again and dispatched", async () => {
const record = emptyRecord();
await decide(api, resolvedLane(), { verifyCapped, record });
const again = await decide(fakeApi(), resolvedLane(), { verifyCapped, record });
assert.equal(again.result, null);
assert.equal(asked.length, 2);
assert.match(again.lines.join("\n"), /\(recorded\)/);
const answers = [{ cap: "verify:repeated-fail: fails at 3 heads, the cap is 3", supersededAtHead: false }, { cap: null, supersededAtHead: true }];
const verifyCapped = () => answers.shift();
const capped = await decide(fakeApi(), resolvedLane(), { verifyCapped, record });
assert.equal(capped.result, null, "capped: no round");
assert.equal(record.handled.size, 0, "the cap is not recorded as handling the head");
const api = fakeApi();
const cleared = await decide(api, resolvedLane(), { verifyCapped, record });
assert.deepEqual(cleared.result, { number: 42, workflowRunId: "38779200001" });
assert.deepEqual(api.calls.dispatch.map((call) => call.inputs["pr-number"]), ["42"]);
assert.equal(answers.length, 0, "a superseded head FAIL is a clean head (#17646): the second run reads the verifier again");
});

// A sibling pull request's FAIL run the reader cannot read may hide the cap:
Expand Down Expand Up @@ -276,8 +280,6 @@ test("a PR skipped because the listing did not fit warns with the reader's detai
assert.ok(!sibling.lines.some((line) => line.includes("verify-deadline-skip")), sibling.lines.join("\n"));
});

// A verifier PASS at a new head clears no cap, so the pass-only dispatch
// starts no round either.
test("a pass-only dispatch of a PR whose pr-verify FAILs are at the cap gets no round", async () => {
const api = fakeApi();
const { result, lines } = await decide(api, resolvedLane(), { passOnly: true, verifyCapped: () => "verify:repeated-fail: fails at 3 heads, the cap is 3" });
Expand Down Expand Up @@ -319,7 +321,6 @@ test("a pass-only dispatch names the head superseded only when the gate's reader
assert.deepEqual(await inputs({ passOnly: true, verifyCapped: () => ({ cap: null, supersededAtHead: false }) }), [undefined]);
assert.deepEqual(await inputs({ passOnly: true, verifyCapped: () => null }), [undefined]);
assert.deepEqual(await inputs({ verifyCapped: () => ({ cap: null, supersededAtHead: true }) }), [undefined]);
// A cap the reader found still skips the round, superseded or not.
assert.deepEqual(await inputs({ passOnly: true, verifyCapped: () => ({ cap: "verify:repeated-fail: fails at 3 heads, the cap is 3", supersededAtHead: true }) }), []);
});

Expand Down
7 changes: 1 addition & 6 deletions .github/scripts/pr-unblock/fix-ci-dispatch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import { failingChecks } from "./fix-ci-context.mjs";
import { prHold, reviewReader } from "./gate-source.mjs";
import { HEAD_LAG_STOP, KILL_SWITCH_STOP, killSwitchStop, laneStop, releasesHead } from "./limit-stop.mjs";
import { serverFailure } from "./request-budget.mjs";
import { final as capFinal, deadlineWarning } from "./verify-cap.mjs";
import { deadlineWarning } from "./verify-cap.mjs";

export const DEFAULTS = Object.freeze({
base: "main",
Expand Down Expand Up @@ -683,11 +683,6 @@ export async function dispatchCiFixes({
log(warning);
}
log(`skip fix-ci #${node.number}: pr-verify's FAILs are at the cap or cannot all be read (${verifyCap}); pr-merge closes it for a fresh attempt, so no fix-ci round`);
// The cap never clears for the head: later runs skip it before any
// read. A sibling read that failed is read again next run.
if (capFinal(verifyCap)) {
markHandled(record, checkName, node.headRefOid);
}
continue;
}
if (fixCiRuns.some((run) => run.conclusion === "NEUTRAL" && run.title === HEAD_LAG_STOP)) {
Expand Down
19 changes: 9 additions & 10 deletions .github/scripts/pr-unblock/fix-ci-dispatch.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -241,17 +241,16 @@ test("a PR whose pr-verify FAILs are at the cap gets no fix-ci round", async ()
assert.match(lines.join("\n"), /^skip fix-ci #5: .*verify:repeated-fail/m);
});

test("a capped head is recorded, so the next run skips it without reading the verifier again", async () => {
test("a capped head whose FAIL a later pass superseded is read again and dispatched", async () => {
const record = emptyRecord();
let reads = 0;
const verifyCapped = () => {
reads += 1;
return "verify:repeated-fail";
};
await run({ pages: [[pr(5)]] }, { verifyCapped, record });
const { api } = await run({ pages: [[pr(5)]] }, { verifyCapped, record });
assert.equal(reads, 1);
assert.deepEqual(api.calls.dispatch, []);
const answers = ["verify:repeated-fail: fails at 3 heads, the cap is 3", null];
const verifyCapped = () => answers.shift();
const capped = await run({ pages: [[pr(5)]] }, { verifyCapped, record });
assert.deepEqual(capped.api.calls.dispatch, [], "capped: no round");
assert.equal(record.handled.size, 0, "the cap is not recorded as handling the head");
const cleared = await run({ pages: [[pr(5)]] }, { verifyCapped, record });
assert.deepEqual(cleared.api.calls.dispatch.map((call) => call.inputs["pr-number"]), ["5"]);
assert.equal(answers.length, 0, "a superseded head FAIL is a clean head (#17646): the second run reads the verifier again");
});

test("a head whose sibling FAIL run cannot be read is skipped but not recorded", async () => {
Expand Down
17 changes: 9 additions & 8 deletions .github/scripts/pr-unblock/verify-cap.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
// verify-cap.mjs: whether pr-verify's FAILs on a pull request are at the
// merge gate's cap (`verify:repeated-fail`), read by the gate's own reader,
// babysit_verify_evidence.py `evidence`, so the cap is counted in one place.
// The cap never clears for the pull request: a fix round's push could never
// merge, so feedback-dispatch.mjs and fix-ci-dispatch.mjs start no
// address-feedback or fix-ci round on it and post nothing; the pr-merge lane
// closes it for a fresh attempt at its issue (owner decision 2026-10-29). A
// The cap applies only when a FAIL that is not superseded stands at the head
// (owner decision Q245,
// https://github.com/melodic-software/claude-code-plugins/issues/17646); FAILs
// at earlier heads alone never reach it, and a later supersession of the
// head's FAIL clears it. While it applies, the pr-merge lane closes the pull
// request for a fresh attempt at its issue (owner decision 2026-10-29), so
// feedback-dispatch.mjs and fix-ci-dispatch.mjs start no address-feedback or
// fix-ci round on it and post nothing, and record nothing, so a head whose
// cap cleared is read again. A
// FAIL run of another pull request for the same issue that cannot be read
// (`verify:unreadable` with the reader's SIBLING_UNREADABLE detail), or an
// artifact listing that does not fit in this caller's limit (a detail that
Expand Down Expand Up @@ -155,9 +160,6 @@ async function fetchCarry(env) {
}
}

// Whether a verifyCapReader answer never clears for the head, so a
// dispatcher records the head as handled: the cap does, a sibling read that
// failed may clear next run.
export const final = (answer) => typeof answer === "string" && answer.startsWith(CAPPED);

// The workflow annotation for a skip because the listing did not fit in the
Expand Down Expand Up @@ -193,7 +195,6 @@ function stderrSummary(stderr) {
// A function of { number, head, base, expected } that returns the reader's cap refusal,
// `verify:repeated-fail` with its detail (the FAILed heads), the sibling
// read's or the caller limit's `verify:unreadable` with its detail, or null.
// Only the first never clears for the head (`final`).
// `base`: the pull request's base commit, so the reader takes the gate's
// merge.max-verify-fails (the lower of that commit's and main's).
// `expected`: refusals the round is sent for, which warn nothing.
Expand Down
6 changes: 4 additions & 2 deletions docs/conventions/pr-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1635,8 +1635,10 @@ merge:
max-minutes: 60
max-skips: 3
# pr-verify FAILs at this many distinct heads of one PR hold it, never to
# merge unattended, whatever a later pass says, so pushing until the
# verifier passes once does not merge it (owner decision 2026-10-21). The
# merge unattended (owner decision 2026-10-21), when one that is not
# superseded stands at its head; FAILs at earlier heads alone leave a pass
# at the head to decide (owner decision Q245,
# https://github.com/melodic-software/claude-code-plugins/issues/17646). The
# pr-merge lane closes a lanes App one for a fresh attempt at its issue,
# and address-feedback and fix-ci start no more rounds on it (owner
# decision 2026-10-29).
Expand Down
Loading
Loading