Skip to content

ci(pr-pipeline): accept review verdicts from workflow_run lane runs - #17584

Closed
kyle-sexton wants to merge 10 commits into
mainfrom
ci/review-verdict-readers-lane-runs
Closed

kyle-sexton wants to merge 10 commits into
mainfrom
ci/review-verdict-readers-lane-runs

Conversation

@kyle-sexton

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

Copy link
Copy Markdown
Member

Refs: #17537

Summary

Phase A of #17537 (owner decision Q8): the readers-first change. Every reader of the hosted review lanes' verdicts now accepts a verdict from either the caller's own pull_request run or a future workflow_run lane run (pr-review-hosted-lane.yml, pr-review-security-hosted-lane.yml). No lane run exists today, so every verdict is unchanged; phase B can move the lanes without a flag day.

Fix

A lane run is found through the index check run named for its workflow on the head (external_id = run id). It is bound only on its own record: path, event workflow_run, head branch main, both repositories, and the run-name <name> #<pull request> <head sha>. When a head has a bound lane run, readers read that run and not the pull_request run that started it. An index page that is not whole fails closed.

Readers changed:

  • ci-status (pr-require-checks.yml): lane_run in the review-lanes step, and the cost-hold step's notice reader.
  • merge gate (Python): collect_lane_runs (each bound lane run stood on its head, with that head's tree), bind/_lane_runs, _noticed_head in babysit_merge_policy.py, and the lane-comment checker in babysit_lane_binding.py.
  • mjs: lane-binding.mjs (laneRunTarget, boundLaneRun, laneRunsAt, comment checker; copies regenerated), merge-holds.mjs noticedHead, clear-escalations.mjs reviewLanesClean and laneReview, feedback-dispatch.mjs (reviewedHead, reviewRunAt, the unsent sweep's triggers), and the reconciler's pending check.
  • test_floor_paths.py and test_merge_holds_sync.py now take the hold-paths callers from sync-hold-floor.py BLOCKS instead of naming the two files.

Not changed: pr-review-hosted.yml, pr-review-security-hosted.yml, PENDING_REMOTE and the secrets check (all owned by #17516). pr-dispatch-feedback.yml is unchanged: its rerun-ci-status job can start on a lane run only once its on.workflow_run.workflows list names the lane workflows, and scripts/workflow-self-paths.test.sh fails any workflow naming a -lane.yml file before it exists, so the job's lane handling moves to phase B with the trigger list and the lane files.

Verification

Each reader has tests for: a bound lane run is accepted; a lane run whose PR number, head SHA, branch, event or path does not match is refused; the existing pull_request tests still pass. Run locally after merging origin/main:

  • scripts/ci-review-lanes.test.sh, scripts/ci-hold-cost-decision.test.sh, scripts/ci-rerun-ci-status.test.sh (unchanged), scripts/workflow-self-paths.test.sh
  • node: lane-binding, pr-merge/*, pr-unblock/*, maintenance-reconcile-lost-runs/*, resolve-config/*
  • babysit-prs Python suite (pytest), including test_merge_holds_sync.py, which checks that the JS and Python cost-decision readers agree on the lane-run cases

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj

kyle-sexton and others added 6 commits November 19, 2026 21:23
Every reader of the hosted review lanes' verdicts now accepts a run of the
caller's workflow_run lane (pr-review-hosted-lane.yml,
pr-review-security-hosted-lane.yml) as well as the caller's own
pull_request run. A lane run is found through the index check run named
for its workflow on the head (external_id = run id) and bound only on its
own record: path, event workflow_run, head branch main, both repositories,
and the run-name `<name> #<pull request> <head sha>`. At a head with a
bound lane run, that run is read, not the pull_request run that started it.

No lane run exists yet, so every reader decides as before; each now makes
one index read per head and lane.

Refs: #17537

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
…ne run

rerun-ci-status holds no checks: read, so a pull_request run's completion
reads no index check runs and costs what it did before. Drop the clauses of
comments that named only the pull_request run, answer the index read in
enable-auto-merge's fake, and point the read-floor wait comment at
WAIT_BUDGET_SECONDS.mergeGroup, which replaced ciStatusVerify.

Refs: #17537

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 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-20T03:09:10.006691Z 7b8f380 PR opened
ℹ️ 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: 7b8f3809b4

ℹ️ 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".

Comment on lines +1007 to +1008
read_api index "the $name check runs on $HEAD_SHA" \
"repos/$GITHUB_REPOSITORY/commits/$HEAD_SHA/check-runs?check_name=${name// /%20}&filter=all&per_page=100"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Grant checks read permission for the new lane-index lookup

When a workflow_run lane completion reaches this reader, newest_review calls the Checks API using github.token, but rerun-ci-status still grants only contents: read, actions: write, and pull-requests: read (lines 730–733). The missing checks: read permission causes this request to be refused, and read_api eventually exits before rerunning CI Status. Although phase A does not yet produce these lane completions, the newly added reader will fail when phase B enables them. Add checks: read to this job alongside the lookup.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

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

Security review: no security issues found

This review covered blocking only findings. The lane already reviewed earlier heads, the last being 06524f62. The new head 756e0066 merges origin/main into the branch. The only hunk that is new relative to that review is a comment edit about READ_FLOOR_WAIT_ENV in babysit_gh.py, and it changes no code. I re-read every hunk of all 34 listed files in .claude-lane/pr.diff. The three copies in identical.txt (the plugins/work-items/lib/lane-binding*.mjs files and the work-items change note) match their first paths, and their paths change nothing about what the content does.

What I checked

The PR adds a second source of review-lane verdicts to each reader: a workflow_run "lane run" of pr-review-hosted-lane.yml or pr-review-security-hosted-lane.yml. Several readers are merge holds under the trust-control list:

  • merge-holds.mjs noticedHead
  • clear-escalations.mjs reviewLanesClean and laneReview
  • the ci-status review-lanes and cost-hold steps in pr-require-checks.yml
  • the babysit-prs modules babysit_gh.collect_lane_runs, babysit_review_evidence._lane_runs, babysit_merge_policy._noticed_head and babysit_lane_binding

I checked whether this new source lets through anything the base stopped:

  • A lane run is bound only on its own record. Every port requires event == "workflow_run", the -lane.yml path, head_branch == "main", both repository and head_repository equal to this repository, and the exact run-name <name> #<pr> <head>. The ports are laneRunTarget/boundLaneRun/laneRunsAt in lane-binding.mjs#L111-L153, the copy in merge-holds.mjs laneRunsAt, the Python bound_lane_run/lane_runs_at, and the jq filters lane_runs/bound_lane_run in pr-require-checks.yml. A workflow_run run only executes the default branch's copy of a workflow. So no PR author, same-repository branch or fork can produce a run that passes. A pull_request run of a file added at the lane path fails the event check.
  • A forged index check run can only deny. The external_id values in the index only name run ids. Each id is regex-checked, read again, required to match String(run.id) === id, and then bound on that run's own record. An index that is not whole fails closed: JS throws, Python raises RuntimeError (which becomes PolicyReadError), and bash takes keep or return 1. At worst a forged index blocks a merge; it never passes one.
  • The pull_request run is replaced only by a main-authored run. At a head that has a bound lane run, the readers drop that head's pull_request run. This is a stricter source than the branch-authored run it replaces, and the lane run's status and conclusion are still checked.
  • _on_head takes no outside input. It moves a bound lane run onto the head named in its validated run-name, using that commit's tree read from git/commits/<head>.
  • The lane-comment checkers stay bound. In JS and Python, a lane-run comment counts only when the run is bound to the PR's base repository, the PR number and the binding SHA. The head-branch rule for pull_request runs is unchanged.
  • feedback-dispatch.mjs refuses other PRs. It skips a lane run whose run-name names another PR (reviewed.pr !== number), and the same-repository and completed-status checks still apply.
  • No shell injection in the new jq code. Run ids are validated by regex before they are interpolated into paths, and $PR_NUMBER and the SHAs come from validated sources.

Token scopes, the trusted-actor list, the kill switch and the actions under .github/actions/ are unchanged. No plugin manifest changed. The PR description contains no instructions aimed at this lane.

Spend note: each verdict reader makes one or more extra GitHub API reads per head and lane (the index check-run page plus each run it names). This uses API rate limit only and starts no 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 7b8f3809b423dab8b0577c6f16be41718ba0ccfe; the summary is in this lane's pull request comment.

claude-lane: claude-review

Comment on lines +1007 to +1008
read_api index "the $name check runs on $HEAD_SHA" \
"repos/$GITHUB_REPOSITORY/commits/$HEAD_SHA/check-runs?check_name=${name// /%20}&filter=all&per_page=100"

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.

rerun-ci-status reads the check-runs index without checks: read.

This job's permissions block (L730-L733) grants only contents: read, actions: write and pull-requests: read, so the job token's checks scope is none. The comment above newest_review says so ("the job holds no checks: read"), and so does the shell test ("as the job holds no checks: read"). Yet when a lane run's completion starts the job, this line calls GET commits/$HEAD_SHA/check-runs with that token. The check-runs list endpoint needs the Checks read permission for an installation token, unless the repository is public.

How it fails: phase B adds the lane workflows to on.workflow_run.workflows. The first lane-run completion then gets a refused read here, and read_api stops the step, so ci-status is never re-run for that head. The "readers-first" step is supposed to make that change safe, and this reader breaks it. scripts/ci-rerun-ci-status.test.sh stubs gh, so no test exercises the token's scope.

Fix: add checks: read # find a review caller's lane run through its index check run to this job's permissions now, alongside the reader. If the change relies on the repository being public, say so in the comment instead.

claude-lane: claude-review

}


class LaneRunTests(unittest.TestCase):

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.

The new test class is defined after if __name__ == "__main__": unittest.main().

unittest.main() calls sys.exit once the classes defined above it have run. So running python test_babysit_lane_binding.py reports success without ever defining LaneRunTests (or MAIN_TIP, LANE_PATH, lane_record, REFUSED). LaneRunGateTests in test_babysit_gh_lane_run_carry.py#L530 has the same problem, appended after that file's unittest.main() at L523-L524.

CI's pytest still collects both classes, but running either file directly quietly skips every new lane-run test. Move the if __name__ == "__main__": block back to the end of each file.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 756e0066272f7e080470b52c38f0a373a4df6bdb: read 37 of 37 changed file(s); 1 finding(s), 0 as inline comments.

CI code review: PR #17584, lane-run verdict readers (phase A of #17537), blocking only

This lane has already reviewed earlier heads of this PR (the last was 06524f6), so this review reports only blocking findings. I read the whole change in all 34 files on the to-read list. I skipped the three copies listed in identical.txt: the work-items lane-binding.mjs and lane-binding.fixtures.mjs, and the work-items changelog fragment. They sit at plain library and fragment paths, where the same content does nothing different.

No new blocking findings on this head. The new head merges origin/main. The only new line in the PR's diff is a comment in babysit_gh.py, which now names WAIT_BUDGET_SECONDS.mergeGroup in place of ciStatusVerify. That matches rate-guard.mjs, which no longer has a ciStatusVerify key.

Prior findings

What I checked on this head

  • The same binding rules everywhere. These readers all check path, event workflow_run, head branch main, both repositories and the exact run-name <name> #<pr> <sha>:
    • JS: laneRunTarget/laneRunsAt and merge-holds.mjs's local laneRunsAt;
    • Python: bound_lane_run/lane_runs_at;
    • shell: lane_runs/bound_lane_run in pr-require-checks.yml.
  • Failed reads keep the hold. An index page that does not read whole throws, raises or returns 1. The callers catch it as before:
    • clear-escalations: read's wrapper and laneReview's try;
    • merge-holds: carries;
    • Python: PolicyReadError, caught in _carries;
    • ci-status: keep in the cost-hold step, return 1 in the review-lanes step;
    • the reconciler: its per-PR catch.
  • Every API object the readers are given has laneRunsAt. createGitHubApi adds it, so the reviewRunAt callers at feedback-dispatch.mjs L1805 and L1841 get it. The test fakes that reach the new code have it too.
  • Lane runs are read on the head their run-name names. The cost-hold jq sets .head_sha = $sha, _on_head moves attempts and jobs onto that head and its tree, and noticedHead/_noticed_head record the listed head.
  • Edge case, not blocking. reviewRunAt calls laneRunsAt with no PR number. If two pull requests share one head SHA, it can return a lane run that names the other PR. dispatchFeedback then skips with a logged reason (lane run … reviewed #X, not #Y) and dispatches nothing wrong.

Notes

  • Closing issue: the PR context names no closing issue (only Refs: #17537), so there are no acceptance criteria to check.
  • Loosened checks: Loosened-check verdict: fail (lane default: no verdict or patterns line in the prompt); patterns: 0. The prompt has no decision-record line, so I did not check the citation requirement.
    • The readers accept the same passing status-job verdict from a second run location, still bound to the same PR and head on the run's own record. I do not judge that a check accepting more. Whether that trust boundary holds is for the security lane.
    • Some test assertions changed:
      • expected read counts went up by one, for the new index read;
      • "check-runs" in path became "/annotations" in path;
      • the /commits greps became pulls/77/commits.
    • Each change keeps the property its assertion is named for, now that the change adds a read under commits/<sha>/check-runs, so none of them loosens a check.
  • Spend: each reader makes one more GitHub API read per head and lane (plus one per indexed run). That is API rate budget, not a billed charge.
  • Verification: I ran no tests. The PR body's test runs are the author's claim and were not checked here.

Verifier dropped 0 of 0 candidates.

kyle-sexton and others added 4 commits November 19, 2026 22:27
pr-dispatch-feedback.yml named pr-review-hosted-lane.yml and
pr-review-security-hosted-lane.yml, which do not exist yet, so
scripts/workflow-self-paths.test.sh failed. The job cannot start on a
lane run until its workflow_run trigger list names the lane workflows,
which phase B adds with the lane files, so the handling moves there.

Refs: #17537

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
…atch

A shipped copy of a shared library changed, so sync-shared-copies.sh
--check-bump needs a fragment whose bump is not none in each carrier.

Refs: #17537

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBVgbERyakZ33T4AetfRj
@kyle-sexton

Copy link
Copy Markdown
Member Author

Superseded: the owner backed out the claude-lanes environment move (hub Q242, 2026-11-20). The 16 Claude org secrets stay the single source, so the review lanes no longer need to move to workflow_run for secret access. #17537 closes with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant