Skip to content

fix(source-control): wait for pr-verify's verdict before a merge - #18288

Merged
kyle-sexton merged 6 commits into
mainfrom
fix/merge-waits-for-pr-verify
Nov 23, 2026
Merged

kyle-sexton merged 6 commits into
mainfrom
fix/merge-waits-for-pr-verify

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Refs: #14293

Summary

The merge queue keeps removing groups. Over the 24 hours to 2026-11-22T23:05Z, 8 merge-group runs failed. Each failed job's annotations were read:

Cause Runs Pull requests
mask.test.ts linearity timing flake (Check Catalog) 3 #18202, #18205, #18208
Queued by a session before or at a pr-verify FAIL 2 #18240, #18205
Head moved after the lanes App armed (hold as designed) 1 #18258
Stale standards-sync PR (Check Managed Files, as designed) 1 #18230
Lint Shell git fetch answered HTTP 403 1 #18185

No run in that window failed at the token floor (#16642). #18227 fixed the flake at 20:21Z.

The two pr-verify removals came from session merges:

Both were queued under the owner login through the merge phase. That phase never read pr-verify's verdict.

Fix

  • plugins/source-control/skills/pull-request/reference/merge.md §4.1 adds step 3. When the base runs pr-verify and pr-verify judges the PR's author, the merge phase reads the verdict at the pinned head and merges or enqueues on a pass. While the verdict is missing, it reads again every 60 s for up to 30 minutes. A FAIL, a moved head or a failed read holds. With still no verdict after 30 minutes (pr-verify down, or a head it skips), it merges and reports that no verdict was read, so a pr-verify outage stops no merge. The step applies to a user-approved merge and to a merge after AI review (§4.2.1). The approval step is renumbered from 4 to 5, and its two references are updated.
  • plugins/source-control/reference/providers/github/pull-request/merge.md adds "Read the pr-verify verdict". The command finds pr-verify by .github/workflows/pr-verify.yml at the base commit. It decides which authors pr-verify judges from merge.verify-authors, the lanes App identity and the trusted-actor list, as resolve-pr.mjs does. It then reads the four exact pass names the merge queue's CI Status step reads (-pass and -pass-notes, each with and without the head-branch digest), counting only unexpired artifacts from default-branch runs. A FAIL is the pr-verify-failed label.
  • I did not use babysit_verify_evidence.py evidence, the lanes' reader. Run from a session against this repository, it refused (38339 artifacts in 384 pages need 391 s for a whole listing ... past the 300 s listing cap). It lists every artifact, so its cost grows with the repository.
  • .changes/source-control/fix-merge-waits-for-pr-verify-c722d483.md (patch).

Verification

I ran the provider command as written, with the placeholders filled, read-only:

These checks pass on the branch: scripts/check-affected.sh --base origin/main (22 passed, 2 skipped), scripts/check-changelog-fragments.sh --check and scripts/check-org-repo-tokens.sh --check.

Why the wait ends in a merge, not a hold

The merge queue's own CI Status step requires a pr-verify pass only for a lanes App pull request (.github/workflows/pr-require-checks.yml, the ci-status comment on merge-holds.mjs verdictHold: "in the merge queue a lanes App pull request also needs a verifier pass at its head"). For other authors the queue admits a head with no verdict. A hold after 30 minutes would therefore be a new stop the queue does not make, and during a pr-verify outage it would stop every session merge. So the wait only avoids queueing into a FAIL that is about to land; with no verdict by then, the merge goes ahead. A lanes App PR's FAIL sets no label and reads missing, and the queue's own check still holds it.

Remaining

Related

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 22, 2026 20:43
A session's merge queued heads pr-verify had not judged, or had failed,
and the merge queue then removed them. The merge phase now reads the
verdict at the pinned head by the four pass names the merge queue's CI
Status step reads, waits up to 30 minutes while it is missing, and holds
on a FAIL (the pr-verify-failed label), a moved head or a failed read.
It applies only where the base runs pr-verify and pr-verify judges the
author under merge.verify-authors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ict read

A later pass removes pr-verify-failed, so the label outranks an older pass
at the same head. The setup reads run once; each 60-second pass reads the
pull request and at most four artifact names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 23, 2026 02:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T02:21:25.158527Z 474ed4b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 474ed4ba03

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed be961f4242701bfa0c123ec30accda9118188d7c: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #18288 at be961f42

No security issues found. This lane already reviewed an earlier head of this PR, so this review was blocking only: it reports only CRITICAL or IMPORTANT findings.

I read every hunk of all 3 changed files in .claude-lane/pr.diff: the changelog fragment, plugins/source-control/reference/providers/github/pull-request/merge.md and plugins/source-control/skills/pull-request/reference/merge.md. None of them is on a trusted path.

What I checked:

  • The change only adds a hold. Before this PR, the session merge phase never read pr-verify's verdict. Now it can hold on a FAIL label, a moved head, a failed read, or a failed pr-verify.yml lookup other than HTTP 404. When the verdict is still missing after 30 minutes, the merge goes ahead, which is what the base already did. The merge queue's CI Status step in .github/workflows/pr-require-checks.yml is unchanged. So are merge-holds.mjs, resolve-pr.mjs, the user-approval step (renumbered from 4 to 5) and the §4.2.1 conditions. No hold on untrusted provenance gets weaker.
  • Skip cases. A non-default base, a fork head (now .head.repo.full_name != .base.repo.full_name, using GitHub's own spelling) and a Bot-type dependency manager are PRs pr-verify never judges. On them the step behaves as the base already did. The bot check needs .user.type == "Bot", so a human account named renovate is not skipped.
  • Pass predicate. An artifact counts only when its run is completed and success, its path is .github/workflows/pr-verify.yml, its event is workflow_run, it ran on the default branch, and both repository and head_repository equal the PR's base repository. This is no looser than CI Status, so a pass uploaded mid-run, or by another workflow or a fork, does not count.
  • Injection. The only value a PR author controls that reaches the scripts is .head.ref. It is piped through jq -j into sha256sum and only its hex digest is used. Run IDs are API numbers. $DEFAULT and $BASE_REPO come from the base repository's API record. MODE, LANE and the trusted IDs are read from the base commit, not the PR head. No author text is interpolated into a shell or jq program.
  • Trust controls and instruction surface. No trusted-actor list, token request, kill switch or merge-hold script changes. No guardrail is removed: the comprehension-quiz step is only renumbered from 3 to 4, and its text is unchanged.

Settled threads. All five settled threads were checked. The two still marked lines changed since resolution: no are not raised again. The three marked yes were fixed by the stricter pass predicate and the 404-only lookup; I checked both in the code above and they widen nothing.

Spend. Each 60-second pass makes about five GitHub API calls, plus one per matching artifact, for up to 30 minutes. This uses API rate budget only, with no billed resource.

No hold: there is no CRITICAL finding, and nothing here can cause a real charge.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 2 inline finding(s) on 474ed4ba0329a66829e1620b95c80a493e3f65b3; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed be961f4242701bfa0c123ec30accda9118188d7c: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Code review (blocking only): PR #18288 at be961f4

I read all three changed files in the full diff: the changelog fragment, the new "Read the pr-verify verdict" section in the provider merge.md, and the new §4.1 step 3 in the skill's merge.md. This lane already reviewed earlier heads of this PR, so this review reports blocking findings only. I found none.

Checked against the code it copies:

  • Pass names and digest. The four names and the 16-hex-digit SHA-256 of the head branch name match the CI Status step. That step computes the digest with printf '%s' "$ref" | sha256sum | cut -c1-16 and lists the names at pr-require-checks.yml#L7150-L7151. The script's jq -j .head.ref | sha256sum hashes the same bytes, with no trailing newline.
  • Run predicate. The script counts a pass only when the run that uploaded it is completed and successful, has path pr-verify.yml, event workflow_run, the default branch as head branch, and this repository as both repository and head_repository. That is the rule the queue applies at pr-require-checks.yml#L7189-L7191. The script compares against the PR's own base.repo.full_name, so the case-mismatch finding from the previous round stays fixed.
  • Skips and author selection. These follow resolvePull's order at resolve-pr.mjs#L1176-L1206: a non-default base or fork head, then a dependency-manager Bot, then verify-authors.
    • The lane-or-owner branch matches trusted-list authors by id (.actors[].id), never by login, as ownerAuthored does.
    • The sed patterns find verify-authors: lane-or-owner and agent-identity: melodic-automation-lanes[bot] under merge: in docs/conventions/pr-pipeline.yaml.
  • Step renumbering. The two references to the old step 4 now point to step 5 (§4.2.1 and §4.2.2). I found no other reference in the skill to the renumbered steps.

Settled threads and prior findings. The four settled threads and the three earlier inline findings are all marked fixed by the owner. The current code matches each fix, so I am not raising any of them again.

Closing issue. The PR names #14293 only with Refs:, so it closes no issue and there are no acceptance criteria to check.

Verification. I ran nothing. The allow and missing runs and the check results in the PR body are the author's claims, and I have not checked them.

Spend. Polling every 60 seconds for up to 30 minutes uses about 5 GitHub API calls per poll, plus one per matching artifact. That is only the session's GitHub API budget. Nothing here changes billing.

Loosened checks would be marked: fail (default; the prompt has no loosened_check_verdict: or loosened_check_patterns: line); patterns: 0. The change adds a pre-merge wait that did not exist before, so it loosens no check. The prompt has no loosened_check_decision_record: line, so I did not check the citation requirement.

Under the blocking-only rule I dropped two non-blocking candidates myself, without a verifier.

Verifier dropped 0 of 0 candidates.

kyle-sexton and others added 2 commits November 22, 2026 21:34
With pr-verify down, the 30-minute wait now ends in a merge that reports
no verdict was read, not a hold. The merge queue's check requires a pass
only for lanes App pull requests (pr-require-checks.yml, the
verdictHold comment in ci-status), so a hold on every other author would
be a new stop the queue itself does not make. A FAIL, a moved head or a
failed read still holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…inished passes

The verdict wait now answers "nothing to wait for" for a PR pr-verify's
resolver skips before verify-authors (a base other than the default
branch, a fork head, a dependency-manager Bot author), so a Dependabot
merge no longer sits out the 30-minute wait. A failed pr-verify.yml
lookup holds; only an HTTP 404 means the base has no pr-verify. A pass
artifact counts only when its run is a completed, successful
pr-verify.yml workflow_run of this repository on the default branch, as
the merge queue's CI Status step requires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on b32461ba4f84be5839696ed681f821b9f3183edd; the summary is in this lane's pull request comment.

claude-lane: claude-review

kyle-sexton and others added 2 commits November 22, 2026 23:16
…remote's

The skip check and the verdict-run check compared GitHub's canonical
full_name with the owner/repo typed in the remote URL, so a remote that
differs only in case skipped the wait or matched no run. Both now compare
against the PR's base repository as the API spells it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit eb99349 Nov 23, 2026
48 checks passed
@kyle-sexton
kyle-sexton deleted the fix/merge-waits-for-pr-verify branch November 23, 2026 05:28
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant