From bb661d517a5aeaf3090a169cb73ebcbac3cc2889 Mon Sep 17 00:00:00 2001 From: Michael Duncan McArthur Date: Sat, 5 Dec 2026 18:30:03 -0500 Subject: [PATCH 1/2] ship-bot: a control-plane PR that ever had a Medium or High merges only on a clean review (row 1.305) A resolved Medium or High from an earlier commit no longer drops out of the strict check, so a replied Low on such a PR holds until a clean review of a new head. A PR that never had one still merges on a replied Low. Co-Authored-By: Claude Sonnet 5.5 AI-Use: L3 made undo unread (Claude Sonnet 5.5) AI-Use-Standing: https://github.com/gorfednet/ai-use-levels/blob/main/docs/delegation.md 2026-11-18 --- ship-bot/lib/gates.mjs | 12 +++++------- ship-bot/test/controlPlaneThreads.test.mjs | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ship-bot/lib/gates.mjs b/ship-bot/lib/gates.mjs index 7f35a9ec..d5de95a5 100644 --- a/ship-bot/lib/gates.mjs +++ b/ship-bot/lib/gates.mjs @@ -494,12 +494,10 @@ export async function evaluateReview(ctx, repo, pr, sha, { headSince, memo, draf // at 19:08 ET on 13 November 2026 with 5 threads open, each "answered" by the session that wrote it. let strict = requireClean if (!strict && controlPlane) { - // A resolve is the same as a reply, so a thread opened on this head's commit counts resolved or not. - // One from before this head (a fixed High on an earlier commit, resolved) must not deadlock the pull request. - // A Low-only relief round past the cap is not skipped: a reply never lifts a Medium or High here. - const all = (await ctx.github.listReviewThreads(repo.slug, pr.number)).filter( - (t) => isReviewerUser(t.author) && (!t.isResolved || t.comments?.[0]?.commit === sha), - ) + // Low-strict (shipping.md, "Review in the inner loop"; plan row 1.305): a control-plane PR that EVER had a Medium or High + // merges only on a clean review, every Low on it fixed with a push. So a resolved Medium or High counts, even one fixed on an + // earlier commit: the head's findings are then Lows or Mediums, and only a clean review of a new head lifts them. + const all = (await ctx.github.listReviewThreads(repo.slug, pr.number)).filter((t) => isReviewerUser(t.author)) if (all.some((t) => !opensWithLow(t.body)) && (await controlPlane())) strict = true } if (strict) { @@ -508,7 +506,7 @@ export async function evaluateReview(ctx, repo, pr, sha, { headSince, memo, draf { key: 'review-not-clean', kind: 'fail', - reason: `The Claude reviewer reported findings on this head (${ctx.redactor.apply(status.detail)}). ${requireClean ? 'The bot readies or readied this pull request itself and the repo deploys' : 'This pull request changes control-plane paths and a Medium or High thread was raised on it (a thread that does not open with Low counts as Medium; fix whatever this head still has, then get a clean review)'}, so it merges only on a clean review: push a fix and get a clean review of the new commit. ${requireClean ? 'A reply or resolving a thread does not lift this.' : "A reply does not lift this, nor does resolving a thread opened on this head's commit. A Medium or High from an earlier commit that has been fixed can be resolved, and then no longer counts."} A change that must merge with its findings goes in a fresh pull request that a session labels after reading them.`, + reason: `The Claude reviewer reported findings on this head (${ctx.redactor.apply(status.detail)}). ${requireClean ? 'The bot readies or readied this pull request itself and the repo deploys' : 'This pull request changes control-plane paths and a Medium or High thread was raised on it at some point (a thread that does not open with Low counts as Medium, resolved or not; fix whatever this head still has, Lows included, then get a clean review)'}, so it merges only on a clean review: push a fix and get a clean review of the new commit. ${requireClean ? 'A reply or resolving a thread does not lift this.' : "A reply does not lift this, nor does resolving a thread. Fix every finding, Lows included, with a push; a Medium or High raised on any earlier commit still counts."} A change that must merge with its findings goes in a fresh pull request that a session labels after reading them.`, }, ], } diff --git a/ship-bot/test/controlPlaneThreads.test.mjs b/ship-bot/test/controlPlaneThreads.test.mjs index 514a85bd..7992a7ce 100644 --- a/ship-bot/test/controlPlaneThreads.test.mjs +++ b/ship-bot/test/controlPlaneThreads.test.mjs @@ -35,9 +35,11 @@ describe('control-plane PRs need a clean review for Medium and High threads (row // Changed 14 November 2026: this test used to assert that a Low-only relief round merged a replied High. // The rule says a reply never lifts a Medium or High on a control-plane change, in any round. const relief = (cmd) => (cmd.args?.[0]?.endsWith('/review-status.mjs') ? { code: 0, stdout: '#7 clean Claude reviewed aaaaaaaaa (round 5 of 4): 1 Low finding(s), triage by reply\n' } : undefined) - it('a High thread that was fixed and resolved does not deadlock, in a relief round too', async () => { - assert.equal(merges((await run(['ship-bot/lib/bot.mjs'], 'High: x', { resolved: true })).gh).length, 1) - assert.equal(merges((await run(['ship-bot/lib/bot.mjs'], 'High: x', { resolved: true, handle: relief })).gh).length, 1) + // Changed 5 December 2026 (row 1.305): a resolved High used to merge when the head's findings were answered. shipping.md's + // Low-strict rule says a control-plane PR that ever had a Medium or High merges only on a clean review, so a resolved one holds too. + it('a High thread that was fixed and resolved holds findings on the head, in a relief round too', async () => { + assert.equal(merges((await run(['ship-bot/lib/bot.mjs'], 'High: x', { resolved: true })).gh).length, 0) + assert.equal(merges((await run(['ship-bot/lib/bot.mjs'], 'High: x', { resolved: true, handle: relief })).gh).length, 0) }) it('a Low-only relief round past the cap lifts a replied Low, never a replied Medium or High', async () => { assert.equal(merges((await run(['ship-bot/lib/bot.mjs'], 'Low: x', { handle: relief })).gh).length, 1) @@ -67,10 +69,16 @@ describe('control-plane PRs need a clean review for Medium and High threads (row await planted.s.run() assert.equal(merges(planted.gh).length, 0, planted.s.logs.join('\n')) assert.match(planted.gh.commentsPosted()[0].body, /control-plane paths and a Medium or High thread was raised/) - // The same pull request with the Medium resolved (opened on an earlier commit) merges on the replied Low. + // Row 1.305: resolving the earlier Medium doesn't lift it. The replied Low still holds; every Low on it is fixed with a push. + // (Before 5 December 2026 this merged, against shipping.md's Low-strict rule.) const fixed = ops([{ ...at(EARLIER, 'Medium: the lock is read before it is taken'), isResolved: true }, at(HEAD, 'Low: a stale comment')]) await fixed.s.run() - assert.equal(merges(fixed.gh).length, 1, fixed.s.logs.join('\n')) + assert.equal(merges(fixed.gh).length, 0, fixed.s.logs.join('\n')) + assert.match(fixed.gh.commentsPosted()[0].body, /control-plane paths and a Medium or High thread was raised/) + // Near miss: the same pull request that never had a Medium or High merges on the replied Low. + const never = ops([at(HEAD, 'Low: a stale comment')]) + await never.s.run() + assert.equal(merges(never.gh).length, 1, never.s.logs.join('\n')) }) it('resolving a High thread this head\'s review opened is a reply, not a triage: still no merge', async () => { assert.equal(merges((await run(['ship-bot/lib/bot.mjs'], 'High: x', { resolved: true, onHead: true })).gh).length, 0) From 5de86bc5492f020992ca3345e6fcbeb9f5a9ccee Mon Sep 17 00:00:00 2001 From: Michael Duncan McArthur Date: Sat, 5 Dec 2026 18:31:00 -0500 Subject: [PATCH 2/2] ship-bot: docs and a no-deadlock test for the row 1.305 change Co-Authored-By: Claude Sonnet 5.5 AI-Use: L3 made undo unread (Claude Sonnet 5.5) AI-Use-Standing: https://github.com/gorfednet/ai-use-levels/blob/main/docs/delegation.md 2026-11-18 --- ship-bot/INCIDENTS.md | 2 +- ship-bot/README.md | 2 +- ship-bot/lib/gates.mjs | 1 + ship-bot/test/controlPlaneThreads.test.mjs | 6 ++++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ship-bot/INCIDENTS.md b/ship-bot/INCIDENTS.md index 01da80e8..49cf12d8 100644 --- a/ship-bot/INCIDENTS.md +++ b/ship-bot/INCIDENTS.md @@ -8,7 +8,7 @@ One dated line per incident whose cause was a pattern: what happened, what chang - 13 November 2026: papers.4thcltr.com 35 merged, then its `verify` setup step (`make verify`, the full Playwright suite on this Mac) failed 7 of 144 specs at 16:33 UTC, all frame-timing wordmark specs, with the 1-minute load at about 11 on 10 cores. The same specs pass at normal load. A setup failure blocks the repository. Changed: a deploy row can say `"needsHeadroom": true`, and ship-bot then holds its merges while the load is above the core count (or can't be read), with a log line, no comment and no block. The papers row has it. - 13 November 2026, 18:50 ET: the gate commands on PATH (`review-status`, `assert-checks-started`, `check-closing-keywords`) run from the detached worktree `.claude/worktrees/gates-main`, which was set to .github 143 that morning and never advanced. After .github 163 merged, the stale `review-status` read `not-run` on clean reviews, and a session labelled .github 164 over a blocking finding. Desk advanced the worktree by hand to 250f176. Changed: ship-bot fetches and moves `gates-main` to origin/main after every merge to .github main (refusing and sending ntfy when it has uncommitted changes), and each gate wrapper warns on stderr when its checkout is behind the last fetched origin/main (`lib/gates-worktree.mjs`, `scripts/gates/test/gate-env.test.sh`, plan row 1.7 follow-up). - 13 November 2026, about 19:00 ET: `install.sh` passed its tests, then `launchctl bootstrap` failed with "Bootstrap failed: 5: Input/output error" and left ship-bot unloaded until Desk bootstrapped it by hand. `bootout` is asynchronous and the bootstrap ran before launchd had removed the old job. Changed: `launchd-load.sh` waits (up to about 10 s) until `launchctl print` no longer finds the job, bootstraps, retries once, and exits non-zero with a clear message when the agent is not loaded at the end (`test/launchd-load.test.mjs`, PR 166). -- 13 November 2026, 19:08 ET: .github 164 merged with 5 reviewer threads open. Each was "answered" by a reply from the session that wrote the code, and every session posts as the owner's login, so the reply proved no one read it. Changed: on a pull request that changes control-plane paths, a Medium or High reviewer thread (read from its first comment) needs a new clean review of a new head; a reply or a resolved thread no longer lifts it (`test/controlPlaneThreads.test.mjs`). A thread resolved from an earlier commit is not counted, so a fixed High does not deadlock the pull request. +- 13 November 2026, 19:08 ET: .github 164 merged with 5 reviewer threads open. Each was "answered" by a reply from the session that wrote the code, and every session posts as the owner's login, so the reply proved no one read it. Changed: on a pull request that changes control-plane paths, a Medium or High reviewer thread (read from its first comment) needs a new clean review of a new head; a reply or a resolved thread no longer lifts it (`test/controlPlaneThreads.test.mjs`). Reversed 5 December 2026 (plan row 1.305): a thread resolved from an earlier commit now counts too, because shipping.md's Low-strict rule holds any control-plane pull request that ever had a Medium or High to a clean review. A fixed High still doesn't deadlock it: a clean review of a new head merges (`test/controlPlaneThreads.test.mjs`). - 13 November 2026: ten labelled pull requests sat refused for hours with no one looking (gorfed.net 143 about 10 h, ssatcy 45, heuristics 90, ops 74/76/77, .github 129/150/153), and papers' `--unblock` at 19:16 ET was lost because a running pass saved its older copy of `state.json` over it. Changed: a labelled PR refused for the same reason for over 2 hours queues one continue-this-PR Herdr job (`stl-…`, plan row 1.14), and `--unblock` takes the pass's lock or, while a pass holds it, leaves a request file the next pass applies (`test/cli.test.mjs`, `test/herdrJobs.test.mjs`). - 13 November 2026: ops 62, 74, 76 and 77 sat labelled and stuck ("required checks never appeared: review / review", from 12:10 to 19:25 ET on 76). The ops row expected the reviewer workflow's `review / review` check, which attaches only when a pull request opens or leaves draft; one review on open and then a `claude review` comment is deliberate, so a later push never gets it. Changed: the ops row expects no check (the verdict is `review-status`), and the config validator refuses any expected check named `review / …` and allows an empty list only with `claudeReview: true`; a repo with no expected checks runs `assert-checks-started --min-runs 0`, because a head pushed after ready has no workflow run at all (`patches/2026-11-13-ops-expected-checks.json`, `test/config.test.mjs`). - 13 November 2026, 19:30 ET: the same class outside .github. Every Herdr link (`gate-run`, `builder-ok`, `herdr-*`), the herdr-core templates and the herdr-reconcile LaunchAgent ran from the ops main checkout, 15 commits behind, so herdr-reconcile ran without its heartbeat ping (ops 75). The capacity app in `~/.desk/capacity-app` was a copy 3 commits behind main, missing its fail-closed fixes. Changed: ops got a `tools-main` worktree, and the links and agent were repointed there at 19:34 ET. Ship-bot advances it after each ops merge (`TOOL_WORKTREES`), clearing untracked files only when main adds them byte-identical. Capacity was reinstalled from gates-main. `install-gates.sh`, `capacity/install.sh` and ops' Herdr `install.sh` refuse any other checkout. fleet-status has a row "Installed tools behind main" (`scripts/lib/installed-tools.mjs`). ops PR 81 and this repository's PR on branch `claude/amazing-antonelli-3db5da`. diff --git a/ship-bot/README.md b/ship-bot/README.md index de094637..2af12105 100644 --- a/ship-bot/README.md +++ b/ship-bot/README.md @@ -18,7 +18,7 @@ pull request, asks: failed, was cancelled, or never ran at all means "not yet". (A cancelled run that is the only thing in the way is rerun once: see "Cancelled runs" below.) 3. Did the **Claude reviewer review the latest commit**, and either find nothing or have **every one of its comments answered**, with a reply - written after the comment or by resolving it? (Exception: a pull request that changes control-plane paths and has a Medium or High thread merges only on a clean review of a new head; a reply never lifts it, and resolving lifts it only for a thread opened on an earlier commit, which then does not count.) It reads this with + written after the comment or by resolving it? (Exception: a pull request that changes control-plane paths and has a Medium or High thread merges only on a clean review of a new head; a reply or a resolve never lifts it, even for a Medium or High fixed on an earlier commit, and every Low on it is fixed with a push: only a clean review of a new head does.) It reads this with `review-status.mjs`. A latest commit the reviewer has not reviewed waits, however many earlier commits it reviewed, unless it only adds clean merges of `main` (redone with `git merge-tree`, no conflict, same tree) to a diff --git a/ship-bot/lib/gates.mjs b/ship-bot/lib/gates.mjs index d5de95a5..58207dec 100644 --- a/ship-bot/lib/gates.mjs +++ b/ship-bot/lib/gates.mjs @@ -497,6 +497,7 @@ export async function evaluateReview(ctx, repo, pr, sha, { headSince, memo, draf // Low-strict (shipping.md, "Review in the inner loop"; plan row 1.305): a control-plane PR that EVER had a Medium or High // merges only on a clean review, every Low on it fixed with a push. So a resolved Medium or High counts, even one fixed on an // earlier commit: the head's findings are then Lows or Mediums, and only a clean review of a new head lifts them. + // (A clean head returned above, so a resolved earlier Medium never blocks a clean review of a new head.) const all = (await ctx.github.listReviewThreads(repo.slug, pr.number)).filter((t) => isReviewerUser(t.author)) if (all.some((t) => !opensWithLow(t.body)) && (await controlPlane())) strict = true } diff --git a/ship-bot/test/controlPlaneThreads.test.mjs b/ship-bot/test/controlPlaneThreads.test.mjs index 7992a7ce..ed1375d9 100644 --- a/ship-bot/test/controlPlaneThreads.test.mjs +++ b/ship-bot/test/controlPlaneThreads.test.mjs @@ -75,6 +75,12 @@ describe('control-plane PRs need a clean review for Medium and High threads (row await fixed.s.run() assert.equal(merges(fixed.gh).length, 0, fixed.s.logs.join('\n')) assert.match(fixed.gh.commentsPosted()[0].body, /control-plane paths and a Medium or High thread was raised/) + // A clean review of a new head merges despite the resolved earlier Medium: no deadlock. + const clean = (cmd) => (cmd.args?.[0]?.endsWith('/review-status.mjs') ? { code: 0, stdout: '#7 clean Claude reviewed aaaaaaaaa: no findings\n' } : undefined) + const gh2 = new FakeGitHub({ threads: [{ ...at(EARLIER, 'Medium: x'), isResolved: true }], files: ['scripts/lib/x.mjs'], pulls: [makePr({ head: { sha: HEAD, repo: { full_name: 'gorfednet/ops' } } })] }) + const { envFiles: e2, setup: u2, deploy: d2, ...row2 } = repoEntry({ slug: 'gorfednet/ops', dir: 'ops', claudeReview: true, mode: 'merge-only', reason: 'r' }) + await scenario({ repos: [row2], github: gh2, runner: makeRunner({ handle: clean }) }).run() + assert.equal(merges(gh2).length, 1) // Near miss: the same pull request that never had a Medium or High merges on the replied Low. const never = ops([at(HEAD, 'Low: a stale comment')]) await never.s.run()