An MIT-licensed GitHub Action that reviews pull requests using one or more models through OpenRouter. It reads the diff and repository context, posts structured findings, and tracks unresolved findings across follow-up reviews. It works with human authors and coding agents; it does not make fixes or merge PRs.
Author: Nathan (FlyOverCoderKY) / RetireGolden, LLC.
Start here: Setup · Choose models · Repository guidance · Trusted profiles · Copy-paste workflow · Agentic loops and merge gates · Troubleshooting · Inputs
- Enable GitHub Actions in the consuming repository and allow this action under any organization action restrictions. The examples use GitHub-hosted
ubuntu-latest. A custom runner needs Bash, Git, GitHub CLI (gh), Python 3.11+, and access to GitHub and OpenRouter; no application dependency installation is needed. - Create an OpenRouter key with credit available and save it under Settings → Secrets and variables → Actions → New repository secret, named
OPENROUTER_API_KEY. An organization secret also works if this repository has access. Keep the value out of chat and committed files. - Save the one-lane workflow below as
.github/workflows/openrouter-review.yml. It includes initial and follow-up reviews, checkout, permissions, and separate concurrency groups. The examples pin this action to a full commit SHA; update that pin deliberately when adopting fixes. - Choose a model using the benchmark guidance. Start with one lane to keep setup and cost simple. API usage is paid through your OpenRouter account; GitHub runner usage is separate. Tool/time budgets are limits on work, not a dollar spending cap.
- Open a small, non-draft PR from a branch in the same repository. Check that the first-pass job posts a review with the expected model and head SHA. Wait for it to finish, then push a change and verify that follow-up posts the next round. This smoke test makes paid model calls.
The examples intentionally skip drafts, fork PRs, and Dependabot PRs. They are a setup for trusted same-repository contributors. Fork review requires a separately designed trusted workflow; changing the event to pull_request_target alone is not a safe installation fix. See Untrusted pull requests.
For a PR already open when you install the workflow, trigger an initial event first (for example, mark a draft ready for review, or reopen an eligible PR). A push alone starts a verification round and cannot bootstrap a missing initial review. If the initial run is partial or fails, resolve its cause and obtain a complete initial review before relying on follow-ups.
Copy this prompt into your coding agent:
Set up FlyOverCoderKY/openrouter-pr-review-action in this repository. Read its
README and action.yml at the exact revision you will use, plus this repository's
agent instructions and existing workflows. Pin the action to a full commit SHA.
Use the README's same-repository, non-draft initial + follow-up workflow, keeping
the two concurrency groups separate. Use ubuntu-latest, a 25-minute job timeout,
full-depth checkout at the PR head, persist-credentials: false, contents: read,
and pull-requests: write. Do not install or execute this repository's code in
the review job. Start with one model; consult the linked benchmark and explain
the choice and its limitations. Keep fail_on: never for the initial rollout.
Use the OPENROUTER_API_KEY Actions secret, never a literal key. Tell me if the
secret or repository settings need my attention; do not request the key in chat.
Preserve existing CI and merge rules, check whether an existing review bot would
duplicate this one, and explain any GITHUB_TOKEN-trigger limitation for my agents.
Validate the workflow without calling a model, then describe how to smoke-test
both review rounds and what paid API usage that test will trigger. Do not enable
automatic merging or treat job success as proof of a clean review.
Use the Review Benchmark leaderboard for model recommendations and measured quality, completion, latency, and cost. Read the methodology and each result's status and configuration alongside its rank. The board is a small, harness-specific comparison; AI-adjudicated results are provisional, and a model's position does not certify its performance on every repository.
- One reviewer: set
modelsto one OpenRouter slug. The default isopenai/gpt-6.1-solon the Azure US ZDR route; it is a configuration default, not a claim that it is always the best value. - Multiple reviewers: supply up to four comma-separated slugs. Each lane reviews the change, adding API cost. A strong individual ranking does not establish that two models catch different defects; assess the extra useful findings before keeping a second lane.
- Judge:
judge_modelcombines reviewer findings. Choose it separately from the reviewers; its merge benchmark answers a different question from the review leaderboard. The default and rationale are below.
Translate a board recommendation into the exact OpenRouter model slug in models, and check its availability in your account. Keep the chosen slug and action SHA explicit in your workflow so a later comparison has a known starting point. The README links to the evolving results instead of maintaining a second ranking table.
This project is independent of its sibling grok-pr-review-action. You do not need that action, the Grok CLI, or an XAI_API_KEY to use this one.
-
One invocation = one review. Callers own concurrency and merge gating.
-
modelsis a comma-separated list of OpenRouter slugs. List length is the lane count (hard-capped at 4; the action fails clearly if you ask for more). -
One lane: by default the judge is skipped and that lane’s structured findings are posted directly. Set
judge_needed: trueto force the configured judge for a single lane. The finding can still name the model that produced it. -
Two or more lanes: parallel review lanes (same prompt on every lane in v1), then an OpenRouter judge union-merges them into one GitHub review when the shared job budget leaves a safe judge window. Every input finding is identity-tracked, the judge must account for every id, only duplicates whose source location, title and evidence agree may merge, and any unaccounted or over-broadly merged finding is deterministically restored verbatim before the shared 80-finding publishing cap is applied. A judge transport/schema failure or an exhausted judge window posts the validated deterministic union and labels that degradation in the review instead of discarding completed lanes. If a repaired or fallback union exceeds the cap, its visible mode reports how many lower-severity findings were omitted. Attribution looks like:
#### 🔴 Issue 1 — Missing auth check `src/api.py:42` · `bug` · identified by x-ai/grok-4.6 and anthropic/claude-sonnet-4.6then the issue body (severity emoji: 🔴 bug / 🟠 risk / 🔵 nit).
-
Prefer a setup → matrix lanes → judge workflow so wall clock is roughly the slowest lane + judge, not the sum. GitHub bills the minutes in parallel. A single-job
role: allrun can still fan lanes in-process; that job is billed as one runner. -
If a lane fails, that lane fail-opens and the judge (or the single-lane poster) continues on whatever structured results arrived. A lane that reports only temporary checkout/tool-access failures produces a visible partial review, never an unmarked clean pass. Action-wide collection, input, artifact, and posting errors still fail the job; judge transport/schema errors preserve validated lane findings via a visibly labeled deterministic union, subject to the documented publishing cap.
Persona lanes are out of v1 (path-scoped guidance is available via path_profiles). The persona input is a reserved unused hook so a later persona feature does not require a rewrite. A future single-persona run should skip the judge the same way (one reviewer = no judge).
Optional REVIEW.md files give reviewers durable project context: invariants,
supported behavior, sources of truth, and concrete failure modes to check.
Root guidance applies across the PR; nested files add guidance for their own
directories. They never exclude changed files or replace your CI rules.
Use a pinned action revision containing this feature and add this input to
both direct-action review steps (role: all, with a full-depth checkout):
with:
review_policy: baseThe workflow examples in this README pin a revision that contains this feature.
Leave review_policy off for unchanged behavior; matrix runs without policy
keep working as before. Setting review_policy: base on setup, lane, or
judge roles requires the prepared flow: setup needs a full-depth checkout of
the reviewed repository and writes the guidance into a context artifact, and
every lane and the judge must receive that artifact through
review_context_file and review_context_sha256 (see
prepared matrix execution).
Policy-enabled matrix roles without the prepared context fail before model
calls. The shipped reusable workflow does not accept review_policy; use the
direct action, or a workflow of your own that threads the setup artifact.
A useful first REVIEW.md can be plain Markdown:
# Review guidance
Persisted documents must remain readable after an upgrade. When storage
formats change, follow the reader, writer, migration, and restore paths.
The contract is documented in docs/storage.md; verify claims against code.
For a bug, identify its trigger, affected behavior, and supporting code.
Uncertainty about a requirement is a question, not proof of a defect.Guidance comes from the immutable target-branch commit, not the PR's file
contents. A PR adding or changing REVIEW.md therefore uses the existing policy;
its new guidance starts applying after merge. The review reports the source
commit and effective-policy digest. All lanes and the merge judge receive the
same frozen guidance, including during verification rounds.
See the policy reference for hierarchy, metadata, validation limits, local previews, privacy, and troubleshooting. For named standard/deep panels, bounds, prepared matrix artifacts, and the authorization boundary, read trusted review profiles.
When asking a coding agent to install this feature, add: “Read the policy reference at the pinned action revision. Enable target-branch REVIEW.md guidance for both all-role review steps, write concise contracts verified against local sources, and run local lint and explain without model calls. Preserve existing CI, model settings, and the findings ledger. Verify the receipt on the next normal PR after the guidance lands.”
Use this for a manually requested deep review. The pin below is a reviewed
action revision that contains the review_profiles input; do not point at an
old tag and assume the feature is there. The handler that authorizes a deep request is a separate integration.
name: OpenRouter profile review
on:
workflow_dispatch:
inputs:
pr_number:
required: true
type: number
review_level:
required: true
type: choice
options: [auto, deep]
default: deep
jobs:
review:
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: read
pull-requests: write
steps:
- name: Resolve PR head
id: pr
env:
GH_TOKEN: ${{ github.token }}
# No checkout has run yet, so gh cannot infer the repository from a git remote.
GH_REPO: ${{ github.repository }}
run: echo "head_sha=$(gh pr view '${{ inputs.pr_number }}' --json headRefOid --jq .headRefOid)" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ steps.pr.outputs.head_sha }}
fetch-depth: 0
persist-credentials: false
- uses: FlyOverCoderKY/openrouter-pr-review-action@212775ffea22e806cddcb706c73a3df26fbcb6d0
with:
github_token: ${{ github.token }}
pr_number: ${{ inputs.pr_number }}
review_level: ${{ inputs.review_level }}
review_profiles: ${{ vars.REVIEW_PROFILES_JSON }}
review_scope: full-pr
review_mode: auto
fail_on: never
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}Replace the checkout ref with the resolved PR head SHA in the workflow that
you install; the PR number must never accidentally select the default branch.
Keep full history and do not execute checked-out PR code. A profile run emits
the resolved profile, level, trigger, registry digest, panel status, context
digest/artifact, satisfaction flag, and reviewed head SHA.
Real auth is OPENROUTER_API_KEY against https://openrouter.ai/api/v1/chat/completions only.
- Create an API key at openrouter.ai.
- Store it as the repository secret
OPENROUTER_API_KEY. - Pass it as a job environment variable, not as an action input (so it stays out of input logs):
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}The action fails closed if the key is empty (when a lane or the multi-lane judge needs it), never prints the key, and never documents or accepts XAI_API_KEY.
This action uses OpenRouter as an external processor. The prompt sends PR metadata, the selected diff, custom_instructions, matching path_profiles, and enabled applicable REVIEW.md guidance to OpenRouter, which routes them to the upstream model provider for each slug. When a lane uses read_file, grep, or list_dir, those paths and file contents can also be sent as model context.
Do not put secrets, credentials, regulated personal data, or unrelated confidential material in PR text, diffs, repository files, custom_instructions, or path_profiles. Obtain organizational approval before enabling the action on private or regulated repositories.
PR title, body, diffs, and repository files are treated as untrusted data. The action does not execute PR code. Before the model runs, tracked files from the reviewed commit are materialized into an inert, size-bounded checkout. Tools are read-only (read_file, grep, list_dir). There is no shell, no writes, no network except OpenRouter, no subagents, and no memory. Secret-like paths (.env, keys, credential files) are refused.
The checkout must contain the reviewed commit object (fetch-depth: 0 is the safest setup). GitHub does not give repository secrets or a write token to ordinary pull_request workflows from public forks. Do not work around that by blindly checking out and executing fork code under pull_request_target.
The default first-pass tool budget is 50 read-only rounds (max_tool_turns), matching the sibling Grok action's default max_turns. The review prompt tells the model to use those tools for blast radius — filename-inventory tests, README / code-map docs, and sibling CI files — not just the embedded diff. A workflow-only PR can still break a test that requires every .github/workflows/*.yml to be listed in docs. Follow-up jobs may pass a lower budget (sibling callers often use 30).
First-pass + latest-commit follow-up with an explicit Grok model override, so the
judge does not run. The current action default is openai/gpt-6.1-sol; the
pinned example below intentionally keeps its explicit model selection.
name: OpenRouter PR review
on:
pull_request:
types: [opened, reopened, ready_for_review, synchronize]
jobs:
first-pass:
if: >-
github.event.action != 'synchronize' &&
github.event.pull_request.draft == false &&
github.event.pull_request.head.repo.full_name == github.repository &&
github.event.pull_request.user.login != 'dependabot[bot]' &&
github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: read
pull-requests: write
concurrency:
group: or-review-first-pass-${{ github.repository }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: FlyOverCoderKY/openrouter-pr-review-action@212775ffea22e806cddcb706c73a3df26fbcb6d0
with:
github_token: ${{ github.token }}
pr_number: ${{ github.event.pull_request.number }}
models: x-ai/grok-4.6
review_scope: full-pr
review_mode: auto
fail_on: never
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
follow-up:
if: >-
github.event.action == 'synchronize' &&
github.event.pull_request.draft == false &&
github.event.pull_request.head.repo.full_name == github.repository &&
github.event.pull_request.user.login != 'dependabot[bot]' &&
github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
contents: read
pull-requests: write
concurrency:
group: or-review-follow-up-${{ github.repository }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: FlyOverCoderKY/openrouter-pr-review-action@212775ffea22e806cddcb706c73a3df26fbcb6d0
with:
github_token: ${{ github.token }}
pr_number: ${{ github.event.pull_request.number }}
models: x-ai/grok-4.6
review_scope: latest-commit
review_mode: verify
fail_on: never
max_tool_turns: "30"
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}The examples pin 212775ffea22e806cddcb706c73a3df26fbcb6d0, the main revision that adds rebase reviews on top of the review-integrity, deadline, and profile work; a branch push does not update existing consumers' pins. Do not put first-pass and follow-up in one concurrency group that synchronize can cancel.
When a latest-commit follow-up detects that the last reviewed commit is no longer an ancestor, it automatically selects rebase: a full-PR review with earlier review context and preserved finding identities. Missing compare inputs or transient compare errors still embed the single latest head commit, with a visible partial verdict. For full-pr and rebase, if GitHub rejects the patch because it exceeds its line limit, the action computes the complete git diff base...head from the full-depth workflow checkout before applying the normal diff-budget triage. A truncated diff is never treated as clean.
The initial round is the exhaustive pass: the prompt requires a per-file, all-severity sweep (bug, risk, and nit), and each coverage entry claims a completed sweep of that file. From verify round 2 onward a severity floor applies: carried nit findings are retired — stated visibly in the round's resolution section, never silently — so follow-up rounds track the bug/risk backlog to convergence instead of re-adjudicating nits forever.
Use the reusable workflow so lanes are separate GitHub jobs. Wall clock ≈ slowest lane + judge. GitHub bills those minutes in parallel. This example runs an initial review only. For a complete loop, the one-job example above also accepts multiple slugs; alternatively add a separate reusable-workflow follow-up job with synchronize, review_mode: verify, review_scope: latest-commit, and its own concurrency group.
name: OpenRouter bake-off
on:
pull_request:
types: [opened, reopened, ready_for_review]
jobs:
review:
if: >-
github.event.pull_request.draft == false &&
github.event.pull_request.head.repo.full_name == github.repository &&
github.event.pull_request.user.login != 'dependabot[bot]' &&
github.actor != 'dependabot[bot]'
concurrency:
group: or-review-first-pass-${{ github.repository }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
uses: FlyOverCoderKY/openrouter-pr-review-action/.github/workflows/pr-review.yml@212775ffea22e806cddcb706c73a3df26fbcb6d0
permissions:
contents: read
pull-requests: write
with:
models: x-ai/grok-4.6,anthropic/claude-sonnet-4.6
review_scope: full-pr
review_mode: initial
# Optional. Default is openai/gpt-5.6-luna (merge only).
# judge_model: google/gemini-3.1-flash-lite # measured lower-latency override
secrets:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}Two or more slugs schedule a judge. When using the direct action, judge_needed: true can also force it for one configured lane; the reusable workflow does not expose that override. The default judge is openai/gpt-5.6-luna, selected by the repeatable synthetic judge benchmark after it retained 50/50 expected findings with 100% precision, zero duplicates, correct verdicts, and no repair/fallback across five runs per fixture. It is a coverage-checked union-merge of already-structured findings plus JSON schema — not a second reviewer and not a filter: identity-tracked coverage plus a conservative source-evidence merge check restore anything the judge drops or over-merges. Judged output preserves validated lane findings up to the shared 80-finding publishing cap; if a repaired or fallback union exceeds that cap, it retains the strongest severities and reports the omitted count in the visible judge mode. If only one of several configured lanes succeeds, that survivor posts directly because there is nothing to merge. Thinking/reasoning is pinned to minimal. In single-job role: all, reviewers get priority: the shared budget reserves 60 seconds total for the judge, plus 180 seconds for publication and a 5-second scheduling margin. Judge retries share one absolute deadline; they do not each reserve another request window. If judging times out or less than 15 seconds remain for a useful request, the posted review explicitly uses the deterministic union of validated lane findings. Dedicated role: judge jobs retain the configured per-request inactivity timeout, with retries bounded by their own remaining job time after publication reserve. Give role: all callers at least a 25-minute job timeout (the reusable matrix workflow uses separate jobs and is not constrained by this shared envelope).
Alternatives (do not change the default unless you mean to):
| Slug | When to use |
|---|---|
google/gemini-3.1-flash-lite |
Lower-latency legacy default; the decision benchmark found lower recall and precision |
anthropic/claude-haiku-4.5 |
An unbenchmarked cross-vendor override |
A judge schema or transport failure is labeled on the posted review and falls back to the deterministic coverage-preserving union, subject to the same visible 80-finding publishing cap. Invalid lane artifacts or action-wide contract errors still fail closed.
In role: all, reviewers finish up to five seconds before the coordinator stops
collecting results, leaving time to save their final diagnostics. The judge and
publication allowances described above remain outside that collection deadline.
HTTP attempts run in isolated workers with a socket inactivity timeout and an
absolute elapsed-time deadline. A response that keeps delivering data can continue
past the inactivity duration, but never beyond the current lane-stage deadline.
Without a stage deadline, the configured HTTP timeout also bounds total elapsed
time. A separate watchdog bounds DNS, connection, and header setup by the configured
HTTP timeout. Active success/error bodies, retries, and shutdown remain bounded
by the absolute stage deadline; GitHub transport calls retain their per-operation elapsed limit.
Tool exploration reserves two inactivity allowances for structured finalization,
capped at half the lane budget. The first finish can use that entire remaining
window. A retry or schema repair uses only time actually left; no speculative
repair reservation cuts a live finish short. Overall lane, judge, publication,
and job budgets do not increase. Incomplete responses never count as a review.
When available, all-role artifact uploads include progress-N.json checkpoints alongside the final
lane files. These contain aggregate request/tool/retry counts, observed usage and
costs, last HTTP error status, transport timeout and connection failure counts, and
provider metadata when known. They contain no prompts, tool arguments, or model
output. A timeout preserves observed costs as incomplete and never turns an
unfinished lane into a successful review.
Final failed lane results also retain aggregate timeout and connection-error history
in their error text, including prepared-context reviews that do not emit progress
checkpoints. The idle_timeouts, connect_timeouts, and elapsed_deadlines counters distinguish silent socket waits, connection/header watchdog expiry, and the worker reaching its absolute stage deadline. Interrupted-lane checkpoint artifacts retain these counters too. This history can include recovered errors; the leading error describes
the terminal failure. HTTP failures already include their immediate status.
Matrix lane artifacts carry a versioned publication context: the collected PR metadata, diff and completeness accounting, prior loop state, and tool-turn policy. The judge uses that saved context without fetching the diff or prior ledger again. A newer push produces a stale, commit-pinned partial summary with no inline comments or new authoritative ledger. Every available lane must agree on its context, model slot, and reviewed commit; mismatches fail before judging or posting. Missing sibling jobs still fail open when another lane supplied a valid context.
Use the same action revision for lanes and judge. Legacy artifacts without this
context cannot be replayed through role: judge; rerun the lanes. Current
role: all artifacts also carry this context for recovery. Contexts are limited
to 16 MiB per lane and checked before model
execution. They contain repository content and must remain trusted workflow
artifacts. Their checksum detects inconsistency, not malicious replacement.
Lane collection is still independent: a metadata or ledger change between lanes
is detected and requires a rerun rather than silently choosing one lane's state.
Pin head_sha to the original reviewed commit in both lane and judge jobs (as the
reusable workflow does). It declares the job's intended target; it is not a live
head lookup. If the final live-head lookup fails, publication is partial with no
new ledger. A missing or invalid context fails the job and posts a best-effort
incomplete status instead of reconstructing review state.
This action runs one review per invocation. It does not implement workflow concurrency or org-specific merge gates (those belong in your reusable caller).
Use separate first-pass and follow-up jobs, or distinct concurrency groups, so a synchronize run cannot cancel an in-progress full-pr review.
The initial review must finish before the fixing agent starts its review/fix/push cycle. A verify round uses the prior trusted review ledger and carries unresolved findings forward. Keep the posting identity (bot_login) consistent, and leave the action's hidden review metadata intact. A custom PAT or GitHub App token requires the matching posting login.
Job success is not a clean-review gate. fail_on: never posts findings without failing for them. fail_on: bugs and fail_on: any fail for matching open findings, but neither independently rejects every partial result. A caller requiring a clean result should inspect verdict as well. For the direct action example, give the action step id: review, then append this step in each review job:
- name: Require a complete clean review
if: always()
env:
REVIEW_OUTCOME: ${{ steps.review.outcome }}
REVIEW_VERDICT: ${{ steps.review.outputs.verdict }}
run: |
test "$REVIEW_OUTCOME" = "success" && test "$REVIEW_VERDICT" = "clean"This gate rejects missing output, failure, and partial or issue-bearing reviews. It does not require every configured model to succeed: a surviving lane can produce a clean review under the action's documented failure policy. If your merge policy requires all lanes, check that separately. The reusable matrix workflow currently exposes neither review outputs nor judge_needed as a caller input; use the direct action when you need this output-based gate or a forced single-lane judge.
Your outer agent loop still needs to confirm that the reviewed head matches the current PR head, that review and required CI actually ran, and that findings have been fixed or explicitly adjudicated. Keep existing test and security gates. The two conditional jobs in the example are not a ready-made branch-protection policy; use a final required gate that accounts for which round should run and does not accept a skipped review as success.
If your coding agent creates PRs or pushes fixes from a workflow using GITHUB_TOKEN, those events ordinarily do not trigger another workflow. Use an appropriately scoped GitHub App/user token for the authoring operation, or design an explicit dispatch path. This README's copy-paste workflows do not include dispatch triggers. See GitHub's workflow triggering rules.
Use review_mode: auto with review_scope: full-pr for a manual recheck. It
reviews the whole PR while retaining the existing ledger, finding IDs, and
rebuttals. With no ledger it seeds an initial review. A corrupt newest ledger
fails visibly; it never silently starts over. Use review_mode: initial
explicitly only when you intend to reset history.
After a rebase or force-push, a divergent latest-commit range automatically
selects review_scope: rebase. You can also select it explicitly with
review_mode: auto or verify when a prior ledger exists. It reviews the
complete current PR at all severities, including nits, and retains its
generation, round progression, and finding IDs. Every current finding,
including disputed findings, must receive a resolution. Valid rebuttals still
apply; specific new evidence can reopen an invalidated dispute under its
existing ID. Earlier fixed or retired findings supply context; a regression
is reported as a new finding with evidence connecting it to the earlier fix.
Rebase context includes historical bot review bodies and replies to their finding threads, including earlier generations, plus recent PR comments. History is untrusted evidence, never instructions. The narrative is bounded to 64,000 UTF-8 bytes, favoring recent material and visibly marking omissions; the current ledger remains separate. A history fetch failure or a detected head, base, or ledger change during collection fails the review for retry. Prepared matrix runs freeze this context so every lane sees the same snapshot.
This scope does not promise a prompt-cache hit. Provider caching depends on matching prompt prefixes, routing, and retention; changed diffs and history can invalidate reuse. Budget for a full review and measure cached-token usage.
Follow-up reviewers put incomplete fixes in the existing finding's resolution.
Additional evidence can name prior_finding_id to retain that open finding's ID;
same-file linked evidence from multiple lanes is published together with every
body retained, only when the original and all additional evidence fit in the
ledger's evidence budget as well as the publishing body limit. Malformed,
unknown, settled, unanchored, cross-file, or oversized links remain separate
visible findings. Distinct defects must not be
linked merely because they share a file. Grouping is not proof of correctness;
the fixing agent still evaluates the evidence.
Agents polling GitHub must paginate reviews, inline comments, and issue
comments. A busy review loop can fill the first reviews page before the latest
bot verdict appears; inline replies are read from the separate comments endpoint.
Match the bot author and explicit reviewed commit SHA,
then read every continuation part: large reviews put their remaining findings
in issue comments. A part-one count is not the total finding count. For example,
gh api --paginate repos/OWNER/REPO/pulls/NUMBER/reviews reads every review page;
also paginate pulls/NUMBER/comments and issues/NUMBER/comments.
| Symptom | What to check |
|---|---|
| Review jobs are skipped | The examples exclude drafts, fork PRs, and Dependabot PRs. Mark an eligible draft ready to start its initial review. These exclusions need to be accounted for in merge policy. |
| No run appears after an agent pushes | Check event filters and whether the authoring operation used GITHUB_TOKEN; see the trigger rules above. |
OPENROUTER_API_KEY is empty / authentication fails |
Check the Actions secret name, organization-secret repository access, OpenRouter key validity, credit, and model access. Do not print the secret to debug it. |
| GitHub reports permission denied / resource not accessible | Check contents: read, pull-requests: write, organization policy, and token identity. Fork and Dependabot events have additional token/secret restrictions. |
| Verify says no prior review exists | Finish an initial full-pr review first. A failed or partial initial review does not publish authoritative loop state. Check bot_login if the posting token changed. |
| Review is partial, or tools cannot inspect files | Read the posted diagnostic. Check full-depth checkout, reviewed commit availability, tool/diff budgets, and whether a new push made the result stale. Do not treat an empty findings list as clean. |
| Green job, but findings remain | fail_on defaults to never. Choose a finding policy and, if required, the explicit verdict gate above. |
| Cost is higher than expected | Count lanes, judge calls, follow-up rounds, and duplicate installed review workflows. Reported provider cost can be incomplete; compare it with your OpenRouter usage. |
The default reviewer is openai/gpt-6.1-sol, pinned to azure/us with provider
fallbacks disabled, data_collection: deny, and zdr: true, matching the tested
benchmark route. Set models to choose another model; the Sol route is never
applied to other model slugs. An explicit model_routes provider overrides the
Sol provider pin while retaining its deny/ZDR requirements. A tier-only override
keeps the Azure provider pin. These defaults apply only to review lanes; the
judge model, routing, and single-lane skip behavior are unchanged.
model_routes is optional trusted configuration keyed by exact model slugs. It
is separate from the profile registry; use only provider identifiers verified
for your account and action revision.
| Input | Default | Notes |
|---|---|---|
role |
all |
all (collect + lanes + optional judge + post) | setup (parse matrix) | lane | judge |
models |
openai/gpt-6.1-sol |
Comma-separated OpenRouter slugs. Length = lane count. Cap 4. |
model_routes |
empty | Trusted JSON keyed by exact review model slug, with optional provider and service_tier (default, flex, priority). Provider pins disable fallbacks. At most four entries and 8,000 UTF-8 bytes. Unlisted Sol lanes use the Azure US ZDR default; other unlisted lanes and the judge retain their existing routing. Never interpolate PR content. |
judge_model |
openai/gpt-5.6-luna |
Independent of models. Used whenever judging is enabled. |
judge_needed |
empty | true enables the judge (and forces it for one configured lane); false skips it. Empty infers from models. A sole survivor from a multi-lane run posts directly. |
github_token |
${{ github.token }} |
Needs pull-requests: write to post the review. |
github_timeout_seconds |
120 |
Per-operation gh or fallback local-git timeout; 1–600. |
job_budget_seconds |
1320 |
Total action budget measured from Python startup. Keep this below the enclosing job timeout so publication and cleanup retain time. |
all_role_deadline_seconds |
empty | Optional cap for concurrent lanes in role=all. Empty derives the cap from job_budget_seconds after judge and publication reserves. |
pr_number |
PR that triggered the workflow | Required for workflow_dispatch. |
fail_on |
never |
Finding policy: never | bugs | any. Operational/schema errors always fail. |
roast_level |
professional |
professional | playful. |
custom_instructions |
empty | Extra prompt text, max 16,000 UTF-8 bytes. Never put secrets here. |
path_profiles |
empty | Caller-owned additive review profiles: JSON [{name?, paths: [globs], instructions}], applied only when a changed path matches (*/? stay within a path segment, ** crosses). Sharpen attention; never narrow the review. Trusted workflow config only — never interpolate PR content, never put secrets here. Max 20 profiles and 16,000 UTF-8 bytes. |
review_policy |
off |
base loads hierarchical target-branch REVIEW.md guidance from full-depth source checkout. Prepared matrix roles consume the setup snapshot. Invalid policy fails before model calls. See the reference. |
review_profiles |
empty | Version-1 trusted named standard/deep registry. Maximum 32 KiB, 8 profiles, 4 lanes per panel. Cannot combine with models, judge_model, judge_needed, or effort. See trusted review profiles. |
review_level |
auto |
auto follows policy; deep raises the request and requires a deep panel. Retains the ledger; does not grant merge authority. |
lane_timeout_seconds |
1080 |
Caller ceiling for prepared profile lanes (1–1800 seconds). The selected profile must fit it and the job budget. |
review_context_file |
empty | Setup snapshot path for prepared matrix lane/judge roles; use only the same workflow run/attempt artifact. |
review_context_sha256 |
empty | Expected setup snapshot digest; required with review_context_file and not a substitute for artifact provenance. |
review_context_output_file |
empty | Optional destination path for role=setup to write review-context.json (parent directories are created). Use this when an external orchestrator needs the snapshot outside the action work directory. |
status_comments |
true |
Live status comment on the PR. |
max_diff_kb |
300 |
Embedded diff cap. Over-budget diffs go through diff-budget triage: generated/vendored/lock-class files (the reviewed commit's .gitattributes linguist-generated/linguist-vendored, lockfile heuristics, large committed JSON snapshots, generated_paths) demote to stubs first, then the largest hand-written files, so hand-written hunks keep the budget. A stub preserves its header, counts, first-hunk reference, and coverage obligation. The inert checkout attempts to materialize stubbed files up to 8 MB; tool access still depends on file type and content safety rules. All omitted hunks, including stub-only packing, produce a partial verdict and do not advance the review-loop ledger. Raise the embed budget to include the full diff for authoritative coverage. Independent collection ceilings reject diffs above 16 MiB or 3,000 files, JSON payloads above 8 MiB, and comment/review lists above 10,000 items. Subprocess output is bounded to 16 MiB across stdout and stderr. |
generated_paths |
empty | Extra globs (JSON array of strings) classified as generated/vendored during diff-budget triage. Demotion only shifts packing priority — never excludes a file from review. Trusted workflow config only — never interpolate PR content. Max 8,000 UTF-8 bytes, 200 globs. |
review_scope |
full-pr |
full-pr | latest-commit | rebase. Initial rounds require full-pr; rebase requires an existing ledger and auto/verify mode. Divergent follow-ups select it automatically. |
review_mode |
auto |
auto continues an existing ledger on any event, or seeds an initial review when none exists. initial explicitly resets history; verify requires an existing ledger. |
effort |
empty | Optional OpenRouter reasoning effort for review lanes. |
max_tool_turns |
50 |
Read-only tool rounds against the inert checkout. 0 disables tools. First-pass default matches the sibling Grok max_turns. Follow-up jobs may pass 30. |
openrouter_timeout_seconds |
180 |
Connection/header setup and socket inactivity limit per OpenRouter HTTP attempt (1–600 seconds). Active responses are bounded by the remaining lane-stage deadline; without one, this also limits total elapsed time. |
lane_index |
0 |
Zero-based matrix index used by role=lane artifact naming. Normally supplied by the reusable workflow. |
lane_model |
empty | Optional validated model override for role=lane. Normally supplied through matrix plumbing. |
lane_results_dir |
empty | Lane artifact output/input directory used by role=lane and role=judge. Normally supplied by orchestration. |
head_sha |
empty | Full reviewed commit SHA resolved by reusable-workflow setup. Internal lane/judge plumbing; pull-request runs use the event head by default. |
bot_login |
github-actions[bot] |
Identity the action posts reviews as. Review-loop ledger state is only trusted from this login. Change it when github_token is a PAT or App token. |
persona |
empty | Reserved, unused in v1. Future single-persona runs should skip the judge. |
Prepared matrix consumers require review_context_file and review_context_sha256
together. When both are supplied to role: all, the action loads the frozen
setup snapshot and does not recollect policy or loop state. The digest detects
mismatches only; it is not authenticity.
| Output | Meaning |
|---|---|
verdict |
clean | issues | partial | error |
issue_count |
Open findings after this round (carried-over plus new; nits retired by the severity floor excluded) |
bug_count |
Open bug-severity findings after this round |
round |
Review-loop round number this run performed |
review_url |
Posted GitHub review |
policy_digest |
Effective guidance SHA-256 when policy is enabled |
policy_base_sha |
Immutable target commit supplying guidance |
models_json |
Parsed slug array (setup / all) |
matrix |
[{index, model}, …] for a GitHub Actions matrix |
lane_count |
Number of lanes |
judge_needed |
Whether the judge is enabled for the configured lanes |
judge_model |
Judge slug used when judging is enabled |
lane_file |
Written lane JSON (role=lane) |
lane_ok |
true when role=lane produced a valid structured artifact |
review_profile |
Resolved trusted profile name |
review_level |
Resolved standard or deep level |
review_trigger |
baseline, policy, or manual selection reason |
registry_digest |
Digest of the trusted registry and exact model routes |
profile_satisfied |
true only when required lanes and runtime constraints are satisfied |
panel_status |
complete, degraded, required_missing, or error |
review_context_sha256 |
Digest expected by prepared matrix consumers |
review_context_artifact |
Prepared context artifact from setup or all-role execution (retention 30 days) |
review_receipt_artifact |
Canonical prepared review receipt artifact (retention 30 days) |
head_sha |
Immutable reviewed PR head resolved by setup |
The judge proposes grouping; published text, severity, attribution and anchors are rebuilt from validated lane findings. Uncertain matches stay separate, which can produce more duplicate-looking comments than free-form semantic merging. Judge rewrites cannot downgrade a source bug or substitute unsupported evidence.
Lane overflow retains the strongest severities, records dropped_findings in the
artifact, and produces a visible partial review without an authoritative ledger.
Malformed candidates anywhere in the response still fail validation. The separate
union publishing cap remains visible in the judge mode. Reported judge charges
are included even when its answer is unusable; unknown attempted charges are
labeled incomplete.
CI on this repo does not need a live OPENROUTER_API_KEY.
For measuring review recall against fixtures with known defects (which DOES
spend tokens and needs OPENROUTER_API_KEY), see the offline bench in
bench/README.md.
python3 -m pip install -e '.[dev]'
ruff check src tests bench
pytestMIT. Copyright (c) 2026 Fly Over Coder.