Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changes/pr-pipeline/fix-trust-briefed-bot-issues-5db14743.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
bump: minor
---

### Changed

- pr-verify takes the body of an issue the lanes App filed as its spec once intake briefed it and no one vetoed it (the owner's standing rule, 2026-11-22). Briefed: the lanes App's newest admission record (`<!-- issue-admission-record -->`, by its account id, canonical and never edited) names the issue's current title and body by sha256. Vetoed: the issue carries a hold label (`needs-human`, `needs-owner-decision`, `needs-reporter-info`, `needs-spec`) or `provenance: untrusted`, or its body has a `hold:` line (`briefedIssue` in `admit.mjs`). A marker in anyone else's comment, an edit after the record, or a label list that cannot be read whole keeps the body out of the spec.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
bump: minor
---

### Changed

- The babysit merge gate trusts an issue the lanes App filed whose newest admission record, posted by the lanes App's account id, canonical and never edited, names its current title and body by sha256, and that carries no hold label, no `provenance: untrusted` and no `hold:` body line (`briefed_issue`), read live at each judgment, matching pr-verify's `briefedIssue`.
39 changes: 37 additions & 2 deletions .github/scripts/intake-triage/admit.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";

import { appCloseKind, isTrustedClose, paginate } from "../../actions/check-trusted-trigger/check-trusted-trigger.mjs";
import { carried, DECISION_LABELS, isStatusLabel, readyWhileDeferred, StatusReadError } from "../../actions/resolve-config/read-status.mjs";
import { carried, DECISION_LABELS, HOLD_STATES, isStatusLabel, readyWhileDeferred, StatusReadError } from "../../actions/resolve-config/read-status.mjs";
import { isDecisionComment, selectTrustedIssueComments } from "../../actions/select-trusted-text/select-trusted-text.mjs";
import { OUTSIDE_ACTOR_LABEL, UNTRUSTED_LABEL, UNTRUSTED_LABELS } from "../pr-merge/merge-holds.mjs";
import { ADMIT_MARKER, refusalText, sayWhy as writeWhy } from "../lib/admission-comment.mjs";
import { writeAdmissionRecord } from "../lib/admission-record.mjs";
import { matchesRecord, readAdmissionRecord, writeAdmissionRecord } from "../lib/admission-record.mjs";
import { stopLine, subIssueLeftOpen } from "../lib/done-evidence.mjs";
import { PERSON_REASONS, personReasonLines } from "../lib/stop-reason.mjs";
import { closingPulls } from "../work-resolve-issue/report-outcome.mjs";
Expand Down Expand Up @@ -2018,6 +2018,41 @@ export function refinementSpec(comments, appId) {
return newest?.lastEditedAt == null ? newest : undefined;
}

// Whether pr-verify takes the body of `issue` (a GraphQL node: title, body,
// author, labels {totalCount, nodes}, comments as an array of nodes, oldest
// first) as spec because intake briefed it and no one vetoed it: the lanes
// App (a Bot whose id is `appId`) filed it; its newest admission record
// (lib/admission-record.mjs: by the App's account id, canonical, never
// edited) names the current title and body by hash; its labels read whole
// hold no HOLD_STATES state and none of UNTRUSTED_LABELS; and its body has no
// BODY_HOLD line. A record that is not one as written counts nothing. The
// owner's standing rule:
// https://github.com/melodic-software/architecture/blob/main/docs/owner-decisions.md?plain=1#L318.
// babysit_verify_evidence.py briefed_issue is its twin. Pure.
export function briefedIssue(issue, appId) {
const labels = issue?.labels;
if (appId === undefined || issue?.author?.__typename !== "Bot" || issue.author.databaseId !== appId || !Array.isArray(labels?.nodes) || labels.totalCount !== labels.nodes.length) {
return false;
}
const held = new Set([...HOLD_STATES, ...UNTRUSTED_LABELS].map((name) => name.toLowerCase()));
if (names(labels.nodes).some((name) => held.has(String(name ?? "").toLowerCase())) || BODY_HOLD.test(String(issue.body ?? ""))) {
return false;
}
const rest = (issue.comments ?? []).map((comment) => ({
id: comment?.databaseId,
user: { id: comment?.author?.__typename === "Bot" ? comment.author.databaseId : undefined },
body: comment?.body,
created_at: comment?.createdAt,
updated_at: comment?.lastEditedAt ?? comment?.createdAt,
}));
try {
const newest = readAdmissionRecord(rest, appId);
return newest !== null && matchesRecord(newest.record, { title: issue.title, body: issue.body });
} catch {
return false;
}
}

// Whether a GraphQL comment is a refinement of the lanes App's (a Bot whose
// id is `appId`): it opens with REFINE_MARKER. Pure.
const appRefinement = (comment, appId) =>
Expand Down
13 changes: 8 additions & 5 deletions .github/scripts/pr-verify/resolve-pr.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import { titleRenamers } from "../../actions/select-trusted-text/select-trusted-
import { issuesSuffix, isVerdictName, NAME } from "./write-verdict.mjs";
import { refsIssue, visibleLines } from "../pr-merge/merge-holds.mjs";
import { GATE_ALIAS, gateEntries } from "../maintenance-reconcile-lost-runs/infra-failure.mjs";
import { ACTIONS_BOT_ID, actionsBotOnly, baseAdmissionRules, carriesSplit, DRIFT_TITLE, driftIssue, vendoredRows, loadRules, ownAgentIds, ownAgentText, personChecks, readSchedule, refinementSpec, SOURCE_LABEL, sourceLabels, SPLIT_CHILD_MARKER, splitChildBody, splitScope, taskItems, trustedDriftSpec, webHostsFrom } from "../intake-triage/admit.mjs";
import { ACTIONS_BOT_ID, actionsBotOnly, baseAdmissionRules, briefedIssue, carriesSplit, DRIFT_TITLE, driftIssue, vendoredRows, loadRules, ownAgentIds, ownAgentText, personChecks, readSchedule, refinementSpec, SOURCE_LABEL, sourceLabels, SPLIT_CHILD_MARKER, splitChildBody, splitScope, taskItems, trustedDriftSpec, webHostsFrom } from "../intake-triage/admit.mjs";
import { issueBody, issueTitle, SCHEDULE_MARKER } from "../recurring-schedule/file-due.mjs";
import { FILING, incidentKey, readMarker } from "../maintenance-monitor-signals/issues.mjs";

Expand Down Expand Up @@ -113,7 +113,7 @@ const shortList = (message, count, cap) => (Number.isSafeInteger(count) && count

const COMMENT_FIELDS = "totalCount pageInfo { hasNextPage endCursor } nodes { databaseId createdAt updatedAt body lastEditedAt author { ...actor } editor { ...actor } }";
const ISSUE_FIELDS = `number repository { nameWithOwner } title body lastEditedAt
author { ...actor } editor { ...actor } labels(first: 50) { nodes { name } }
author { ...actor } editor { ...actor } labels(first: 50) { totalCount nodes { name } }
comments(first: 100) { ${COMMENT_FIELDS} }`;
const ACTOR = "fragment actor on Actor { __typename login ... on User { databaseId } ... on Bot { databaseId } }";
// The pages after the first of an issue's comments.
Expand Down Expand Up @@ -964,7 +964,9 @@ async function compareFiles(github, repository, base, head) {
// body of an own-agent filing no other account edited that carries exactly
// one `source:` label, as admission requires (admit.mjs ownAgentText, under
// main's `own-agents`; ADR 0111,
// https://github.com/melodic-software/claude-code-plugins/blob/main/docs/adr/0111-admit-own-agent-filings-sized-small-or-medium-under-a-per-producer-cap.md). Given the
// https://github.com/melodic-software/claude-code-plugins/blob/main/docs/adr/0111-admit-own-agent-filings-sized-small-or-medium-under-a-per-producer-cap.md),
// and the body of a lanes App filing whose newest admission record names it
// as it is and that no one holds (admit.mjs briefedIssue). Given the
// `base` branch, a closing issue also carries the siblings that delivered part
// of it (`credited_siblings`, creditedSiblings), so its diff is judged for the
// rest. An issue the recurring filer opened takes its body from its row of
Expand Down Expand Up @@ -1114,7 +1116,8 @@ export async function linkedIssues(github, readRefs, repository, number, humans,
const childBody = childBodies.get(issue.number);
const sources = sourceLabels(issue.labels?.nodes);
const ownBody = !written(issue) && childBody === undefined && !String(issue.body ?? "").startsWith(SPLIT_CHILD_MARKER) && sources.length === 1 && SOURCE_LABEL.test(sources[0]) && ownAgentText(issue, ownIds) ? String(issue.body ?? "") : null;
const recurring = written(issue) || childBody !== undefined || ownBody !== null ? null : recurringSpec(issue, schedule);
const briefed = !written(issue) && childBody === undefined && ownBody === null && !String(issue.body ?? "").startsWith(SPLIT_CHILD_MARKER) && briefedIssue({ ...issue, comments: issue.comments.nodes }, laneAppId) ? String(issue.body ?? "") : null;
const recurring = written(issue) || childBody !== undefined || ownBody !== null || briefed !== null ? null : recurringSpec(issue, schedule);
const upstreamDrift = written(issue) || childBody !== undefined || recurring !== null ? null : (driftBodies.get(issue.number) ?? null);
const incident = written(issue) || childBody !== undefined || recurring !== null || upstreamDrift !== null || !mainRedIncident(issue) ? null : MAIN_RED_SPEC;
// A trusted target-subset part's Scope line (admit.mjs splitScope):
Expand All @@ -1126,7 +1129,7 @@ export async function linkedIssues(github, readRefs, repository, number, humans,
...(recurring !== null && { source: "recurring-schedule" }),
...(upstreamDrift !== null && { source: "upstream-drift" }),
...(incident !== null && { source: "main-red-incident" }),
body: written(issue) && typeof issue.body === "string" ? issue.body : (childBody ?? ownBody ?? recurring ?? upstreamDrift ?? incident),
body: written(issue) && typeof issue.body === "string" ? issue.body : (childBody ?? ownBody ?? briefed ?? recurring ?? upstreamDrift ?? incident),
...(scope !== null && { scope }),
comments: issue.comments.nodes.filter((comment) => written(comment) || comment === counted).map((comment) => String(comment.body ?? "")),
// The body's done-when items that refinement lists as checks a
Expand Down
46 changes: 46 additions & 0 deletions .github/scripts/pr-verify/resolve-pr.test.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// test-scope: docs/upstream/*
// Expected values come from the verdict rules in
// docs/conventions/pr-pipeline/README.md ("Verifier verdict"): only a successful pr-require-checks pull_request run of this
// repository starts a verdict, for exactly one open same-repository PR into
Expand Down Expand Up @@ -28,6 +29,7 @@ import { KEPT_JOBS, keptJobs, shapeJobs } from "./upstream-jobs.mjs";
import { artifactName } from "./write-verdict.mjs";
import { bodyVersion, loadRules, REFINE_MARKER, splitItemsLine } from "../intake-triage/admit.mjs";
import { holds, labelHolds } from "../pr-merge/merge-holds.mjs";
import { recordBody } from "../lib/admission-record.mjs";
import { tempDir } from "../../../lib/test-tmp.mjs";

const REPO = "example-org/example-repo";
Expand Down Expand Up @@ -2572,6 +2574,50 @@ test("an own-agent filing's body is spec only while no other account edited it,
}
});

test("a lanes App filing is spec once its admission record names it as it is and no one holds it", async () => {
const BODY = "## Done when\n\n- [ ] Line 3 says nineteen.";
const TITLE = "Fix line 3";
const app = { __typename: "Bot", login: "some-app", databaseId: VECTORS.app_id };
const human = { __typename: "User", login: "someone", databaseId: VECTORS.humans[0] };
const record = (author, text = { title: TITLE, body: BODY }, edited = null) => ({
databaseId: 900,
createdAt: "2026-11-17T00:00:00Z",
updatedAt: edited ?? "2026-11-17T00:00:00Z",
lastEditedAt: edited,
body: recordBody({ actorId: VECTORS.app_id, ...text }),
author,
editor: edited ? author : null,
});
const node = ({ comments = [record(app)], labels = [], body = BODY, author = app, editor = null, total } = {}) => ({
...ISSUE,
number: 8,
title: TITLE,
body,
lastEditedAt: editor ? "2026-11-18T00:00:00Z" : null,
author,
editor,
labels: { totalCount: total ?? labels.length, nodes: labels.map((name) => ({ name })) },
comments: { totalCount: comments.length, nodes: comments },
});
for (const [name, issue, expected] of [
["briefed, no hold", node(), BODY],
["no admission record", node({ comments: [] }), null],
["the record in a listed human's comment", node({ comments: [record(human)] }), null],
["the record in github-actions[bot]'s comment", node({ comments: [record({ __typename: "Bot", login: "github-actions", databaseId: 41898282 })] }), null],
["the body edited after the record", node({ body: `${BODY}\n- [ ] More.`, editor: human }), null],
["the record names another title", node({ comments: [record(app, { title: "Other", body: BODY })] }), null],
["an edited record", node({ comments: [record(app, undefined, "2026-11-17T01:00:00Z")] }), null],
["held needs-human", node({ labels: ["needs-human"] }), null],
["held Needs-Owner-Decision", node({ labels: ["Needs-Owner-Decision"] }), null],
["provenance: untrusted", node({ labels: ["provenance: untrusted"] }), null],
["a hold: body line", node({ body: `${BODY}\nHold: wait for the owner`, comments: [record(app, { title: TITLE, body: `${BODY}\nHold: wait for the owner` })] }), null],
["labels not read whole", node({ total: 60 }), null],
["filed by a listed human's bot twin, not the App", node({ author: { __typename: "Bot", login: "other", databaseId: 99 } }), null],
]) {
assert.deepEqual(await specBody(issue, null), [[8, expected]], name);
}
});

// A trusted target-subset part carries its Scope line's targets as `scope`,
// which narrows its criteria; any other entry carries none.
test("a trusted target-subset child's spec entry carries its scope", async () => {
Expand Down
10 changes: 10 additions & 0 deletions docs/conventions/pr-pipeline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2923,6 +2923,16 @@ listed human or the lanes App, and no run's patch stopped over the scan job's si
(`scan-refused-patch`) since a listed human last added `agent-ready`. A filing short of any of these reads `verify:untrusted-spec`, and a
failed read `verify:unreadable`. github-actions[bot] never counts as an own-agent identity, even if
the list names it, and comments still count only when a listed human wrote them.
A lanes App filing intake briefed and no one vetoed is spec too (the owner's standing rule,
[owner-decisions L318](https://github.com/melodic-software/architecture/blob/main/docs/owner-decisions.md?plain=1#L318)):
the newest `<!-- issue-admission-record -->` comment the lanes App posted, by its account id,
canonical and never edited, names the issue's current title and body by sha256
(`.github/scripts/lib/admission-record.mjs`), its labels read whole carry no hold state
(`needs-human`, `needs-owner-decision`, `needs-reporter-info`, `needs-spec`) and no
`provenance: untrusted`, and its body has no `hold:` line (`briefedIssue` in `admit.mjs`). The
merge gate reads the same facts again at each judgment (`briefed_issue`), and a Work status hold
on the issue still stops a lane merge (`issue_hold_refusal`). A marker in anyone else's comment,
an edit after the record, or a hold keeps the body out of the spec.
The monitoring lane's main-red incident is its own spec too: when github-actions[bot] wrote it and
nobody else last edited it, its title is `Restore the failing required checks on main` (`issues.mjs`
`FILING`) and its first body line is the marker for `incident:main-red`, it counts for a pull
Expand Down
Loading
Loading