fix(claude-review): skip cleanly when a commit has no unique open PR (stop red 'main' review runs)#90
Merged
crowecawcaw merged 1 commit intoJul 8, 2026
Conversation
The review stage (Stage 2) is a workflow_run workflow: GitHub runs it from the default branch and labels every run with that branch. When the PR-resolution guard could not map the trusted head SHA to exactly one open PR, it exited 1 -- painting the Actions tab with red "Claude PR Review" runs labelled with the default branch, which read as broken post-merge reviews even though the guard was correctly refusing to review anything. This is a common, benign case: a workflow_run fires from a collect run whose PR was merged/closed by the time this stage resolves it (e.g. dependabot rebasing several branches onto a freshly-merged tip), or a force-push/close race. Downgrade only the "0 or >1 open PRs" case -- an absence of work, not a forged input -- to a clean skip: set resolved=false, exit 0, and gate every downstream step (checkout, tooling, Bedrock auth, agent) on resolved=true. The security property is unchanged: nothing is reviewed or posted unless a unique open PR is resolved. Malformed head_sha or a resolved PR failing pr_number/base_sha validation still hard-fails. Signed-off-by: Stephen Crowe <6042774+crowecawcaw@users.noreply.github.com>
crowecawcaw
force-pushed
the
claude-review-fail-clean-on-no-pr
branch
from
July 8, 2026 21:51
9a3237a to
039dee9
Compare
crowecawcaw
marked this pull request as ready for review
July 8, 2026 22:36
andychoquette
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Claude PR-review reviewer is not running on post-merge/
mainchanges — but its Actions runs look like it is, and that is the problem this fixes.What's actually happening
collectworkflow, which triggers onpull_request: [opened, synchronize]. There is nopushtrigger, so a merge tomaincannot start a review.workflow_runworkflow. GitHub always runs aworkflow_runfile from the repo's default branch and labels the run with that branch — so every review run shows up asClaude PR Review · main, regardless of which PR it reviewed. That's cosmetic, not behavioral.workflow_runfired — common with dependabot rebasing several branches onto a freshly-merged tip, or force-push/close races), it exited1.The result: a stream of red ❌ "Claude PR Review · main" runs that read as broken post-merge reviews, even though the guard was correctly refusing to review anything and posting nothing. (Concrete example: openjd-rs run #28974565722 failed at "Resolve and validate PR from trusted head SHA" with
found 0; every downstream step — checkout, Bedrock auth, agent — was skipped.)The change
Downgrade only the "0 or >1 open PRs" case — an absence of work, not a forged input — to a clean skip:
resolved=false, emit a::notice::, andexit 0;Collect prior review state, PR-head checkout, symlink strip, base fetch, tooling checkout, Bedrock token install, OIDC creds, token mint, and the agent) onsteps.meta.outputs.resolved == 'true'.The run now finishes green/neutral with nothing posted, instead of red.
Security property unchanged
Nothing is reviewed or posted unless a unique open PR is resolved from the trusted
workflow_runpayload. This is not a relaxation of the guard:head_sha, or a resolved PR whosepr_number/base_shafail validation, is a real integrity problem and still hard-fails (exit 1);Testing
count=0→ skip,count=2→ skip,count=1valid →resolved=true,count=1with bad base SHA → hard-fail. ✅Note
Follow-up (caller-side, in each consuming repo): the
collecttrigger churn from dependabot rebases is what generates these no-op review runs in the first place. Narrowing that is a separate change in the caller workflows, not this reusable one.