Skip to content

Advisory review for labeled fork PRs, pinned to the labeled head - #566

Merged
renmengye merged 3 commits into
mainfrom
feat/review-labeled-head
Oct 23, 2026
Merged

renmengye merged 3 commits into
mainfrom
feat/review-labeled-head

Conversation

@renmengye

Copy link
Copy Markdown
Member

Closes #462: fork PRs get the advisory review once a maintainer applies the review label, and the review covers exactly the head that label event named.

Not ready to merge until the workflow commit lands: the .github/workflows half is a patch the maintainer applies (the agent's tooling cannot write .github/); it will arrive as a second commit on this branch.

Python side (this commit)

  • REVIEW_HEAD_SHA (the event's pull_request.head.sha): the session skips clean, running no model, if the PR has moved off it; otherwise it reads the diff between the base and that head as fixed commits (compare API), so a push after the metadata read cannot swap in another head's diff.
  • Every envelope carries the reviewed head_sha. The post job posts nothing when the envelope's or the event's head differs from the PR's current head, and attaches the review to the reviewed commit (commit_id), so a push during posting cannot move it.
  • The summarizer carries the lenses' common head_sha and skips clean if they disagree.
  • REVIEW_CHECKOUT_BASE=1 adds a brief note that the tree is the base branch and the change is only in the diff.

Workflow side (patch, to be applied)

  • allow_labeled_forks input (default false) on the reviewer and summarizer workflows; with it, the session/summarize and post jobs also run for a fork PR when the event is labeled. The label-name filter stays in the caller's if:, as today.
  • A fork's head is never checked out: the session gets the base commit plus the diff (no allow-unsafe-pr-checkout). Same-repo PRs check out the event's head SHA instead of refs/pull/N/head.
  • REVIEW_HEAD_SHA on every job; the input's description says it needs a reviewer ref with this commit (0.5.1 or later).

Compatibility

Envelopes cross a job boundary. Envelopes without head_sha (an older reviewer ref) still post; callers that pass no REVIEW_HEAD_SHA behave as before; allow_labeled_forks defaults off. Same-repo behavior change: a push during a review session now means that round posts nothing (before, its findings were stamped onto the new head); re-applying the label reviews the new head.

Deferred

  • GitHub notes the compare view and the PR view can pick different merge bases after the base branch changes, so in rare cases the pinned diff can differ from the PR page's (codex round 3, P2). Advisory-only consequence.
  • An older reviewer_ref with allow_labeled_forks on does not pin the head; documented on the input.

Testing

Full gate: ruff, format, mypy, pytest (3176 passed, 7 skipped). Focused tests: moved head skips before the session; unset variable unchanged; pinned diff read between fixed commits; post refuses a stale envelope head and a moved event head; post pins commit_id; summarizer disagreement. The workflow patch was checked for YAML validity and applies cleanly to main; no live label run yet.

Built by DeepSeek-V4.1-Flash (head pinning) and Claude Opus (codex's fixes, workflow patch). Reviewed by codex (three rounds) and Claude.

…e head_sha, post refusal and commit_id; base-tree brief note for forks
@renmengye renmengye added the outerloop:review re-request the advisory review label Oct 23, 2026

@github-actions github-actions 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.

Round 1 — reviewed head 57a2da1b — reviewer hermes/gpt-5.6-terra.

terra
Advisory findings from outerloop — the code owner decides. Reply to disagree; the outerloop:no-review label opts this PR out.

Verdict: 1 blocking, 0 advisory.

1 finding attached to the lines below.

A rejected pinned review can fall back to an unpinned stale comment.

Comment thread src/outerloop/posting.py Resolved

@github-actions github-actions 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.

Round 2 (re-run on the same head) — reviewed head 57a2da1b — reviewer summarizer:hermes/gpt-5.6-terra over coverage+credentials+deployment+general+lifecycle+prose.

terra
Advisory findings from outerloop — the code owner decides. Reply to disagree; the outerloop:no-review label opts this PR out.

Verdict: 2 blocking, 2 advisory.

3 findings attached to the lines below.

A push during post can format comments from the new head. [general] pull_request reads PR metadata, then fetches the live PR diff before the code compares envelope_head with the earlier metadata; a push between those calls lets format_review build B's line anchors and create_pr_review attach them to A. (src/outerloop/review_post_cli.py:64; high confidence)

Verdict: block. The pinned-review fallback can publish stale findings after a moved head, and formatting can race a head change before the comparison. Mixed legacy/pinned envelopes can also be labeled with the wrong head. Rejected as duplicates: [credentials] review_post_cli.py:132 identifies the same unguarded fallback recorded at posting.py:181; [lifecycle] posting.py:181 is the same fallback defect; [coverage], [deployment], and [prose] posting.py:181 agree with the merged fallback finding rather than adding distinct defects.

Comment thread src/outerloop/posting.py Resolved
Comment thread src/outerloop/review_summarize_cli.py Resolved
Comment thread CHANGELOG.md Resolved
… findings cannot be merged under a pinned head; shorter changelog entry
@renmengye renmengye added outerloop:review re-request the advisory review and removed outerloop:review re-request the advisory review labels Oct 23, 2026

@github-actions github-actions 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.

Round 3 — reviewed head 23587e30 — reviewer hermes/gpt-5.6-terra.

terra
Advisory findings from outerloop — the code owner decides. Reply to disagree; the outerloop:no-review label opts this PR out.

Verdict: nothing blocking — 1 advisory note.

1 finding attached to the lines below.

The pinned-review fallback can still post stale findings after a push.

Comment thread src/outerloop/posting.py Resolved
@renmengye renmengye added outerloop:review re-request the advisory review and removed outerloop:review re-request the advisory review labels Oct 23, 2026

@github-actions github-actions 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.

Round 4 — reviewed head 3f09e11b — reviewer hermes/gpt-5.6-terra.

terra
Advisory findings from outerloop — the code owner decides. Reply to disagree; the outerloop:no-review label opts this PR out.

Verdict: 1 blocking, 0 advisory.

1 finding attached to the lines below.

The fallback comment still has a race after the pinned review check.

Comment thread src/outerloop/posting.py Resolved
@renmengye
renmengye merged commit 5a913cc into main Oct 23, 2026
5 checks passed
@renmengye
renmengye deleted the feat/review-labeled-head branch October 23, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

outerloop:review re-request the advisory review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Advisory review: run for fork PRs when a maintainer applies the review label

1 participant