From 6dfe6944187a625b07b6ec512f4535e21904dc12 Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Sat, 21 Nov 2026 17:21:06 -0500 Subject: [PATCH 1/2] fix(pr-pipeline): in-slot re-check honors a label added while the run waited The RECHECK path read only the blocked_by list, so a session-owned, container, wayfind or untrusted label added between admission and the slot was missed and the lane worked an issue a local session owned. It now reads the issue first and takes the full check when such a label is on it. The test's BASE_PATH uses fileURLToPath so the suite runs on Windows. Closes #18061 Co-Authored-By: Claude Opus 5.5 --- ...ix-18061-recheck-session-owned-a0f25a5f.md | 7 +++++ .../work-resolve-issue/check-blockers.mjs | 16 +++++------ .../check-blockers.test.mjs | 28 +++++++++++++------ 3 files changed, 34 insertions(+), 17 deletions(-) create mode 100644 .changes/pr-pipeline/fix-18061-recheck-session-owned-a0f25a5f.md diff --git a/.changes/pr-pipeline/fix-18061-recheck-session-owned-a0f25a5f.md b/.changes/pr-pipeline/fix-18061-recheck-session-owned-a0f25a5f.md new file mode 100644 index 0000000000..b2c1b9eb40 --- /dev/null +++ b/.changes/pr-pipeline/fix-18061-recheck-session-owned-a0f25a5f.md @@ -0,0 +1,7 @@ +--- +bump: patch +--- + +### Fixed + +- The issue lane's in-slot re-check (`check-blockers.mjs` with `RECHECK=true`) now reads the issue before its blocked_by list, so a session-owned, container or wayfind label, or a `provenance: untrusted` label, added while the run waited for its slot stops the run as admission does. Before, an empty blocked_by list let the run proceed without looking at the issue's labels. diff --git a/.github/scripts/work-resolve-issue/check-blockers.mjs b/.github/scripts/work-resolve-issue/check-blockers.mjs index 7470945b9e..44fc6c1634 100755 --- a/.github/scripts/work-resolve-issue/check-blockers.mjs +++ b/.github/scripts/work-resolve-issue/check-blockers.mjs @@ -44,10 +44,7 @@ // // With RECHECK=true it is the read runner's in-slot re-check // (pr-run-activity-read.yml check-broker), after admission passed and the run -// waited for its slot: one read of the blocked_by list decides when the list -// is empty (proceed) or names an open blocker (blocked, as above). A list of -// closed blockers alone takes the full check, since only it judges who -// closed them. +// waited for its slot: https://github.com/melodic-software/claude-code-plugins/issues/18061 // // Environment: // GH_TOKEN the job's GITHUB_TOKEN (issues: read) @@ -114,22 +111,23 @@ export async function main({ env = process.env, github, log = console.log, write const { humans } = loadTrustedList(env.TRUSTED_ACTORS_PATH); const client = github ?? createGitHub({ token: env.GH_TOKEN, apiUrl: env.GITHUB_API_URL || undefined }); const base = `/repos/${repository}/issues/${number}`; - if (env.RECHECK === "true") { + const issue = await client("GET", base); + const routing = readRouting(join(env.BASE_PATH || ".base", "docs/conventions/work-items.yaml"), { who: "check-blockers", log }); + const labels = (issue?.labels ?? []).map((label) => String(label?.name ?? label)); + const isApp = (actor) => actor?.id === appId; + if (env.RECHECK === "true" && !routingLabel(labels, routing) && !untrustedHold({ labels: issue?.labels, events: [], humans, isApp })) { const blockers = await blockersOf(client, base); pending = await stillBlocking(blockers, repository, async () => true, async () => true); rechecked = blockers.length === 0 || pending.length > 0; subs = []; } if (!rechecked) { - const issue = await client("GET", base); - const routing = readRouting(join(env.BASE_PATH || ".base", "docs/conventions/work-items.yaml"), { who: "check-blockers", log }); const trust = await authorTrust(client, repository, issue, humans, appId); outsider = trust === null; drift = trust === "drift"; const events = outsider ? [] : await statusReader({ env, github: client, repository, log }).events(Number(number)); - const isApp = (actor) => actor?.id === appId; held = !outsider && untrustedHold({ labels: issue?.labels, events, humans, isApp }); - routed = outsider || held ? null : routingLabel((issue?.labels ?? []).map((label) => String(label?.name ?? label)), routing); + routed = outsider || held ? null : routingLabel(labels, routing); if (!outsider && !held && !routed) { // The same close admission counts (admit.mjs closedByTrusted), so a split // parent the lanes App closed does not hold an issue admission let through. diff --git a/.github/scripts/work-resolve-issue/check-blockers.test.mjs b/.github/scripts/work-resolve-issue/check-blockers.test.mjs index 221585bf13..fcbc891d1f 100644 --- a/.github/scripts/work-resolve-issue/check-blockers.test.mjs +++ b/.github/scripts/work-resolve-issue/check-blockers.test.mjs @@ -2,6 +2,7 @@ import assert from "node:assert/strict"; import { mkdirSync, rmSync, writeFileSync } from "node:fs"; import { join } from "node:path"; +import { fileURLToPath } from "node:url"; import { after, describe, test } from "node:test"; import { renderSplitRecord, SIZE_SPLIT_MARKER } from "../intake-triage/admit.mjs"; @@ -17,7 +18,7 @@ after(() => rmSync(dir, { recursive: true, force: true })); const TRUSTED = join(dir, "trusted-actors.json"); writeFileSync(TRUSTED, JSON.stringify({ version: 1, actors: [{ kind: "human", id: HUMAN.id, login: HUMAN.login }] })); // BASE_PATH: the checkout whose models.issue-status the field read takes. -const ENV = { GITHUB_REPOSITORY: "o/r", ISSUE_NUMBER: "42", TRUSTED_ACTORS_PATH: TRUSTED, LANES_APP_ID: String(APP.id), BASE_PATH: new URL("../../..", import.meta.url).pathname }; +const ENV = { GITHUB_REPOSITORY: "o/r", ISSUE_NUMBER: "42", TRUSTED_ACTORS_PATH: TRUSTED, LANES_APP_ID: String(APP.id), BASE_PATH: fileURLToPath(new URL("../../..", import.meta.url)) }; const issue = (number, state, { repo = "o/r", reason = state === "closed" ? "completed" : null, closer = HUMAN } = {}) => ({ number, @@ -437,26 +438,26 @@ test("a blocker someone other than the lanes App closed blocks even with an olde }); // The read runner's in-slot re-check (RECHECK=true): a blocker added while -// the run waited for its slot stops it as admission's blocker gate does, on -// one blocked_by read; a list of closed blockers takes the full check. +// the run waited for its slot: https://github.com/melodic-software/claude-code-plugins/issues/18061 describe("the in-slot re-check", () => { const RECHECK = { ...ENV, RECHECK: "true" }; const RECHECK_RUN = { proceed: "true", untrusted: "false" }; + const TWO_READS = ["GET /repos/o/r/issues/42", "GET /repos/o/r/issues/42/dependencies/blocked_by?per_page=100&page=1"]; - test("no blocker proceeds on the one blocked_by read", async () => { + test("no blocker proceeds on the issue read and the one blocked_by read", async () => { const { code, calls, outputs } = await run([], { env: RECHECK }); assert.equal(code, 0); assert.deepEqual(outputs, RECHECK_RUN); - assert.deepEqual(calls, ["GET /repos/o/r/issues/42/dependencies/blocked_by?per_page=100&page=1"]); + assert.deepEqual(calls, TWO_READS); }); - test("an open blocker added since admission stops the run as admission does, on the one read, with the same notice", async () => { + test("an open blocker added since admission stops the run as admission does, on the two reads, with the same notice", async () => { const admitted = await run([issue(7, "open")]); const { code, calls, lines, outputs } = await run([issue(7, "open"), issue(8, "closed")], { env: RECHECK }); assert.equal(code, 0); assert.deepEqual(outputs, SKIP); assert.deepEqual(outputs, admitted.outputs); - assert.deepEqual(calls, ["GET /repos/o/r/issues/42/dependencies/blocked_by?per_page=100&page=1"]); + assert.deepEqual(calls, TWO_READS); const notice = lines.find((line) => line.startsWith("::notice")); assert.match(notice, /^::notice title=blocked::/); assert.match(notice, /#7/); @@ -466,7 +467,18 @@ describe("the in-slot re-check", () => { assert.deepEqual((await run([issue(8, "closed")], { env: RECHECK })).outputs, RUN); const stranger = await run([issue(7, "closed", { closer: STRANGER })], { env: RECHECK }); assert.deepEqual(stranger.outputs, SKIP); - assert.ok(stranger.calls.includes("GET /repos/o/r/issues/42"), "the full check reads the issue"); + assert.ok(stranger.calls.some((call) => call.startsWith("GET /repos/o/r/issues/42/events")), "the full check reads the events"); + }); + + test("a session-owned label added while the run waited skips it as admission does, before any blocker read", async () => { + const { calls, lines, outputs } = await run([], { env: RECHECK, subject: { labels: ["agent-ready", "session-owned"] } }); + assert.deepEqual(outputs, SKIP); + assert.ok(!calls.some((call) => call.includes("/dependencies/")), calls.join("\n")); + assert.match(lines.find((line) => line.startsWith("::notice")), /^::notice title=map issue::the run is skipped: the issue carries 'session-owned'/); + }); + + test("an untrusted label added while the run waited stops it for good", async () => { + assert.deepEqual((await run([], { env: RECHECK, subject: { labels: ["agent-ready", UNTRUSTED] } })).outputs, FINAL); }); test("a blocked_by read that fails stops the run with a warning, not for good", async () => { From 4ec6b45ba1b291b5af59ef26ffbd321487b9d75a Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Sat, 21 Nov 2026 17:26:40 -0500 Subject: [PATCH 2/2] docs(pr-pipeline): restate the in-slot re-check rule beside its link Co-Authored-By: Claude Opus 5.5 --- .github/scripts/work-resolve-issue/check-blockers.mjs | 7 ++++++- .github/scripts/work-resolve-issue/check-blockers.test.mjs | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/scripts/work-resolve-issue/check-blockers.mjs b/.github/scripts/work-resolve-issue/check-blockers.mjs index 44fc6c1634..1b49926540 100755 --- a/.github/scripts/work-resolve-issue/check-blockers.mjs +++ b/.github/scripts/work-resolve-issue/check-blockers.mjs @@ -44,7 +44,12 @@ // // With RECHECK=true it is the read runner's in-slot re-check // (pr-run-activity-read.yml check-broker), after admission passed and the run -// waited for its slot: https://github.com/melodic-software/claude-code-plugins/issues/18061 +// waited for its slot. It reads the issue first: a map or untrusted label on +// it, added while the run waited, takes the full check, as admission does +// (https://github.com/melodic-software/claude-code-plugins/issues/18061). +// Otherwise one read of the blocked_by list decides when the list is empty +// (proceed) or names an open blocker (blocked, as above). A list of closed +// blockers alone takes the full check, since only it judges who closed them. // // Environment: // GH_TOKEN the job's GITHUB_TOKEN (issues: read) diff --git a/.github/scripts/work-resolve-issue/check-blockers.test.mjs b/.github/scripts/work-resolve-issue/check-blockers.test.mjs index fcbc891d1f..41f8b76e3b 100644 --- a/.github/scripts/work-resolve-issue/check-blockers.test.mjs +++ b/.github/scripts/work-resolve-issue/check-blockers.test.mjs @@ -438,7 +438,9 @@ test("a blocker someone other than the lanes App closed blocks even with an olde }); // The read runner's in-slot re-check (RECHECK=true): a blocker added while -// the run waited for its slot: https://github.com/melodic-software/claude-code-plugins/issues/18061 +// the run waited for its slot stops it as admission's blocker gate does; a +// map or untrusted label added in that wait, or a list of closed blockers, +// takes the full check (https://github.com/melodic-software/claude-code-plugins/issues/18061). describe("the in-slot re-check", () => { const RECHECK = { ...ENV, RECHECK: "true" }; const RECHECK_RUN = { proceed: "true", untrusted: "false" };