Skip to content

Add org-wide OpenRouter code review workflow - #16

Merged
FlyOverCoderKY merged 5 commits into
mainfrom
openrouter-org-review
Sep 10, 2026
Merged

FlyOverCoderKY merged 5 commits into
mainfrom
openrouter-org-review

Conversation

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor

Adds .github/workflows/openrouter-code-review.yml, the org-required OpenRouter PR review that an org ruleset ("Require OpenRouter code review") will point at so every pegma-dev repo, including new ones, gets it without a per-repo file.

  • Two review lanes: meta/muse-spark-1.2 and z-ai/glm-5.3-flash; the action's default judge (openai/gpt-5.6-luna) union-merges their findings into one review.
  • First pass on opened / reopened / ready_for_review / workflow_dispatch (full-PR, 50 tool rounds); follow-up on synchronize (latest-commit, 30 tool rounds). Separate concurrency groups per pass type, same shape as grok-code-review.yml.
  • Pinned to FlyOverCoderKY/openrouter-pr-review-action@4471f596 (main, 2026-09-09).
  • Fork and Dependabot PRs get no org secret, so the review steps are skipped and the job still succeeds; otherwise a required workflow would block those PRs forever.
  • fail_on: never: the ruleset only requires the workflow to complete; the review is not a merge gate.

Uses the existing org secret OPENROUTER_API_KEY (visibility: all repositories).

🤖 Generated with Claude Code

Two cheap lanes (meta/muse-spark-1.2, z-ai/glm-5.3-flash) merged by the
default judge, first-pass on open/reopen/ready and a latest-commit
follow-up on synchronize. Pinned to openrouter-pr-review-action main
4471f596. Fork and Dependabot PRs skip the review step but still succeed
so the org ruleset that will require this workflow never blocks them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Grok Grok Build Review — no issues

Review complete. Nothing actionable to report.

This workflow is correctly structured to run as an organization-required check. Fork PRs, Dependabot PRs, and a missing OPENROUTER_API_KEY skip only the review steps, so the job still reports success. A single per-PR concurrency group with cancel-in-progress disabled is the right arrangement for ledger-based scope selection: synchronize narrows to latest-commit only when a github-actions[bot] review already contains the ledger marker, and otherwise performs a full-PR review. No defects.

Reviewed commit 9daea4b · workflow run

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-10T01:09:19.183172Z 1b4c5af 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.

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

OpenRouter review posted (issues). #16 (review)

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

OpenRouter pull-request review

Verdict: issues
Scope: full-pr (full-pr)
Mode: initial
Commit: 1b4c5af7b04b7811e806d9f0194463f1e3c74f72
Judge: openai/gpt-5.6-luna (repaired(canonical+10): source coverage preserved before publication cap)
Cost: $0.0965 (lanes $0.0904 + judge $0.0061)

Lanes

  • meta/muse-spark-1.2: ok (6 finding(s), 87.7s, 43852+8401 tokens (18899 cached), 4 tool round(s), via Meta, $0.0697)
  • z-ai/glm-5.3-flash: ok (6 finding(s), 309.7s, 68092+26755 tokens (6912 cached), 5 tool round(s), via Wafer, $0.0207)

Findings

🔴 Issue 1 — First-pass review missing explicit tool-round budget

.github/workflows/openrouter-code-review.yml:98 · bug · identified by meta/muse-spark-1.2

Follow-up runs with max_tool_turns: "30" but first-pass runs without any max_tool_turns input, so it falls back to the action's undocumented default instead of the 50 rounds promised in the header comment ("full-PR review, 50 read-only tool rounds") and in the PR body.

Evidence: .github/workflows/openrouter-code-review.yml "Run OpenRouter review (first pass)" (around line 98) has review_scope: full-pr with no max_tool_turns, while "Run OpenRouter review (follow-up)" (around line 117) sets max_tool_turns: "30". The sibling .github/workflows/grok-code-review.yml explicitly sets GROK_MAX_TURNS: ... && '15' || '50' for both lanes, showing the intent to pin both. Comment lines 11-12 say first pass is 50 rounds.

Checked action pin FlyOverCoderKY/openrouter-pr-review-action@​4471f59 docs via repo checkout and sibling workflow; no local default verified (no network). Could not falsify that the action defaults to 50 — proof gap — so keep finding and either set max_tool_turns: "50" on the first pass or correct the comment/body to match the actual default.

🔴 Issue 2 — workflow_dispatch runs always fail: gh pr view runs without -R/GH_REPO in an empty workspace

.github/workflows/openrouter-code-review.yml:74 · bug · identified by z-ai/glm-5.3-flash

Manually dispatching the workflow with a pr_number always fails at the "Resolve PR head" step, so the "optional manual re-run" feature advertised in the header comment (line 27) is dead on arrival, and if an org admin ever dispatches it the job shows red.

Mechanism: gh pr view is only reached when EVENT_HEAD_SHA is empty, i.e. exactly for workflow_dispatch (for pull_request events the head SHA is always present). At that point no actions/checkout has run, so the workspace is not a git repository, and the step sets GH_TOKEN but never GH_REPO and does not pass -R. The gh CLI resolves the base repository from GH_REPO or git remotes only — it does not read the runner-provided GITHUB_REPOSITORY — so the call fails with a repository-resolution error, and under set -euo pipefail the job exits non-zero.

Fix: add GH_REPO: ${{ github.repository }} to the step's env, or call gh pr view -R "$GITHUB_REPOSITORY" ....

Evidence gap: I cannot execute gh here; the claim rests on gh's documented repo-resolution order (env GH_REPO → git remotes), which is why every common workflow pattern sets GH_REPO explicitly. The sibling grok-code-review.yml never calls gh before checkout, so it does not have this defect.

🟠 Issue 3 — Draft PRs skip entire job, may not satisfy required-workflow check

.github/workflows/openrouter-code-review.yml:42 · risk · identified by meta/muse-spark-1.2

When a PR is a draft, the job if: (github.event_name == 'workflow_dispatch' || (pull_request && !draft)) evaluates to false, so the whole review job is skipped rather than completed with a skipped-review notice. For an org ruleset that "requires the workflow to complete" (header comment line 17 and PR body fail_on: never note), a skipped workflow is not a completed successful workflow and can leave the required check unsatisfied until ready_for_review.

Evidence: .github/workflows/openrouter-code-review.yml:42 job-level if: filters drafts. Fork/Dependabot handling correctly keeps the job alive (REVIEW_ELIGIBLE gate inside steps, job still succeeds). Draft handling does not follow that pattern. Sibling grok-code-review.yml:40 copies the same draft-skip, so the inconsistency is inherited, not intentional for the fork case.

Checked via list_dir .github/workflows, grep for workflow inventories, and reading both workflow files. No docs exempt drafts from the required check were found; proof gap is how the org ruleset is configured (skipped vs success). Prefer keeping job alive and gating steps via REVIEW_ELIGIBLE or an explicit IS_DRAFT notice, matching the fork pattern, or document that drafts are intentionally unsatisfied until ready.

🟠 Issue 4 — workflow_dispatch SHA resolution can hard-fail the required check

.github/workflows/openrouter-code-review.yml:68 · risk · identified by meta/muse-spark-1.2

On workflow_dispatch, EVENT_HEAD_SHA is empty and the Resolve PR head step runs gh pr view "$PR_NUMBER" --json headRefOid with set -euo pipefail. If the input is mistyped, the PR is deleted, or the API is throttled, gh exits non-zero and the entire job fails before the Summary's always() can rescue the required-workflow status. Because fail_on: never only applies to the review action, this pre-step failure will block merging under the ruleset forever until re-dispatched.

Evidence: .github/workflows/openrouter-code-review.yml:64-77 always executes Resolve PR head, even for ineligible PRs, and writes steps.pr.outputs.head_sha used by actions/checkout@​3d3c42e... with ref: ${{ steps.pr.outputs.head_sha }}. Sibling grok-code-review.yml:53 avoids this by checking out github.event.pull_request.head.sha || github.sha and passing pr_number directly to the action.

Checked the checkout in the new file and the grok file for comparison; no retry or empty-SHA validation exists. Falsification considered that pr_number is required: true on workflow_dispatch, but type is string and no validation of numeric/existence is done.

🟠 Issue 5 — Dependabot/actor check misses variants and can block PRs

.github/workflows/openrouter-code-review.yml:60 · risk · identified by meta/muse-spark-1.2

If a Dependabot PR arrives as dependabot-preview[bot] or with github.actor not equal to dependabot[bot] (e.g., renovate[bot] or a human acting for Dependabot), REVIEW_ELIGIBLE will be true. The job will then reach Require OPENROUTER_API_KEY with an empty org secret (forks/Dependabot get no secret) and exit 1, failing the required workflow and blocking the PR forever — the exact outcome the REVIEW_ELIGIBLE gate was meant to prevent.

Evidence: .github/workflows/openrouter-code-review.yml:56-61 checks only github.event.pull_request.user.login != 'dependabot[bot]' && github.actor != 'dependabot[bot]'. No endsWith('[bot]') or dependabot substring test, and no renovate handling. Sibling grok has no eligibility gate at all, so this is the only guard.

Checked via grep OPENROUTER and grep dependabot — only those two lines reference the actor. No tests inventorying eligible actors were found. Could not prove Dependabot never uses the preview name in this org, so retain finding; consider contains(..., 'dependabot') or endsWith(..., '[bot]') and document scope.

🟠 Issue 6 — Pinned action's input/output contract and claimed behavior are unverifiable from this repo; mismatches degrade silently

.github/workflows/openrouter-code-review.yml:104 · risk · identified by z-ai/glm-5.3-flash

If any input name or semantic assumed by this workflow does not match FlyOverCoderKY/openrouter-pr-review-action@​4471f596, the required check still goes green while the review silently does something else — e.g. the two-model lanes and 30-turn follow-up budget are never applied.

The workflow relies on inputs models, review_scope, review_mode, max_tool_turns, status_comments, roast_level, fail_on, github_token, pr_number and outputs verdict, issue_count, review_url, and the header comment asserts unverified behavior: default judge openai/gpt-5.6-luna, union-merge of the two lanes, parallel lanes, "read-only tool rounds", and a "existing ledger" dedup for latest-commit. Composite actions typically ignore unknown inputs with only a warning, so a wrong name (e.g. model/max_turns as the sibling grok action uses) would not fail the step. The Summary step would then show n/a for missing outputs.

What I checked: no vendored copy of the action, no docs, and no tests in this repo reference it (greps for openrouter hit only this new file); the sibling grok-code-review.yml uses a different action with a different input vocabulary, so it provides no corroboration. I cannot fetch the upstream action.yml from this review environment, so the contract is a proof gap that must be verified against the pinned commit before merge.

🟠 Issue 7 — Untrusted PR content reviewed by an agent holding pull-requests: write and the org OpenRouter key

.github/workflows/openrouter-code-review.yml:106 · risk · identified by z-ai/glm-5.3-flash

Any contributor's PR can carry prompt-injection payload text; the review action checks out that content and is handed github_token with pull-requests: write (workflow-level permissions, lines 36–37) plus OPENROUTER_API_KEY in its env (line 115). If the review agent is allowed to invoke any tooling that can run commands or make HTTP calls — the header comment's "read-only tool rounds" is a contributor-authored claim that cannot be verified here — injected text in the diff could exfiltrate the OpenRouter key to an attacker endpoint or post/modify PR content using the write token. persist-credentials: false (line 97) protects the checkout token but not the token and key explicitly passed to the action step.

Concrete cost: org-wide OPENROUTER_API_KEY exfiltration or PR tampering triggered by a single malicious PR in any pegma-dev repo once the org ruleset enables this everywhere. Mitigating scope: the token is a restricted github.token (contents: read), so it cannot push code or mint releases.

Proof gap: the action's sandboxing/tool restrictions live outside this repository and I cannot inspect them; this should be confirmed against the pinned action source before org-wide enforcement.

🟠 Issue 8 — timeout-minutes: 25 below the sibling's 30 for a comparable first pass; a timed-out run fails the required check and blocks merge

.github/workflows/openrouter-code-review.yml:50 · risk · identified by z-ai/glm-5.3-flash

A large full-PR review that exceeds 25 minutes gets its job killed by the runner and the job fails — fail_on: never does not protect against this, because the timeout is enforced by the runner outside the action. Once the org ruleset requires this workflow, a failed run means the required check fails and merge is blocked, the exact outcome the PR says fail_on: never is meant to avoid.

The sibling grok-code-review.yml budgets timeout-minutes: 30 for a single 50-turn lane; this job runs a 50-round full-PR pass (two lanes plus the judge merge round) in 25 minutes. Even with lanes in parallel, wall time is the slowest lane plus the judge round, so 25 minutes is strictly tighter than the established precedent for the same turn budget.

Fix: align with the sibling's 30 minutes (or higher) or document why the tighter budget is safe.

🔵 Issue 9 — Header comment overclaims pinned judge model

.github/workflows/openrouter-code-review.yml:6 · nit · identified by meta/muse-spark-1.2

Header lines 6-7 state the default judge is openai/gpt-5.6-luna and that OR_MODELS union-merges via that judge, but the workflow never pins a judge input. If the action's default changes, the review behavior silently changes while the comment and PR body still claim gpt-5.6-luna.

Evidence: .github/workflows/openrouter-code-review.yml:4-7 comment and env.OR_MODELS: meta/muse-spark-1.2,z-ai/glm-5.3-flash (line 52) list only the two lanes. Neither review step sets a judge/judge_model input. The action pin is to 4471f596... (main, 2026-09-09) which fixes the code but not the comment's claim about the model.

Checked sibling workflow and profile README — no judge pin found. Either pass judge: openai/gpt-5.6-luna explicitly (if the action supports it) or soften comment to "action's default judge at this pin" rather than naming a specific model.

🔵 Issue 10 — Minor inconsistencies vs sibling workflow

.github/workflows/openrouter-code-review.yml:50 · nit · identified by meta/muse-spark-1.2

Several small drifts from the established grok-code-review.yml pattern increase maintenance cost and risk misinterpretation:

  • timeout-minutes: 25 vs grok's 30 (line 50) — with 50 potential tool turns plus checkout of full history (fetch-depth: 0), 25 may be tight and a timeout fails the required check.
  • Summary Pass field uses shell $([ "${IS_FOLLOW_UP}" = true ] (quoted string true) with if: always() but VERDICT/ISSUES/REVIEW_URL are empty when both lanes are skipped, showing n/a without indicating why (fork vs draft vs error) — consider adding REVIEW_ELIGIBLE reason.
  • status_comments: "true" is a string; grok also uses a string, but the action may expect boolean — consistent but worth confirming at the pinned SHA.
  • Resolve PR head runs even when REVIEW_ELIGIBLE != 'true' (line 64), wasting a gh call; grok avoids the extra step.

Evidence: compared .github/workflows/openrouter-code-review.yml:50,64,143 with .github/workflows/grok-code-review.yml:48,53,70.

Checked via list_dir .github/workflows and read_file on both workflows; no test or doc inventories the timeout. Align timeout or justify the difference, and gate the resolve step behind eligibility or validate head_sha non-empty before checkout.

🔵 Issue 11 — Header comment and PR body claim "50 tool rounds" for the first pass, but max_tool_turns is never set

.github/workflows/openrouter-code-review.yml:11 · nit · identified by z-ai/glm-5.3-flash

The header comment (lines 11–12) says the first pass is a "full-PR review, 50 read-only tool rounds", and the PR body repeats this, but the first-pass step (lines 104–115) omits max_tool_turns entirely — only the follow-up sets "30" (line 130). The actual first-pass budget is whatever the action's default is, which is unverifiable from this repo. The grok sibling pins its turn budgets explicitly (50 first pass, 15 follow-up), so the asymmetry looks like an omission rather than intent.

Concrete cost: if the action's default is lower than 50, first-pass reviews get fewer rounds than the documented design; if higher, cost is unbounded by the workflow. Fix: set max_tool_turns: "50" on the first-pass step or correct the comment.

🔵 Issue 12 — actions/checkout pin comment # v7.0.1 unverifiable and diverges from the sibling's v4.2.2 pin

.github/workflows/openrouter-code-review.yml:95 · nit · identified by z-ai/glm-5.3-flash

The SHA 3d3c42e5aac5ba805825da76410c181273ba90b1 is annotated # v7.0.1, but nothing in this repo can confirm the SHA↔version mapping, and the otherwise-parallel sibling grok-code-review.yml pins a much older 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2. If the annotation is wrong, future supply-chain audits and version bumps keyed off the comment would be mistaken about what revision is actually running. Worth a quick confirmation that the SHA really is the v7.0.1 tag (or that the comment should say something else) before merge.

Workflow run

id: pr
env:
GH_TOKEN: ${{ github.token }}
EVENT_HEAD_SHA: ${{ github.event.pull_request.head.sha }}

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.

🟠 workflow_dispatch SHA resolution can hard-fail the required check (risk)

On workflow_dispatch, EVENT_HEAD_SHA is empty and the Resolve PR head step runs gh pr view "$PR_NUMBER" --json headRefOid with set -euo pipefail. If the input is mistyped, the PR is deleted, or the API is throttled, gh exits non-zero and the entire job fails before the Summary's always() can rescue the required-workflow status. Because fail_on: never only applies to the review action, this pre-step failure will block merging under the ruleset forever until re-dispatched.

Evidence: .github/workflows/openrouter-code-review.yml:64-77 always executes Resolve PR head, even for ineligible PRs, and writes steps.pr.outputs.head_sha used by actions/checkout@​3d3c42e... with ref: ${{ steps.pr.outputs.head_sha }}. Sibling grok-code-review.yml:53 avoids this by checking out github.event.pull_request.head.sha || github.sha and passing pr_number directly to the action.

Checked the checkout in the new file and the grok file for comparison; no retry or empty-SHA validation exists. Falsification considered that pr_number is required: true on workflow_dispatch, but type is string and no validation of numeric/existence is done.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not applicable. A workflow_dispatch run executes on the dispatch ref, not the PR head SHA, so its check run is not the one the ruleset evaluates for the PR; a failed manual run cannot block a merge. b47554c also validates pr_number and the SHA, and sets GH_REPO, which removes the failure the scenario relies on.

${{
(github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.head.repo.full_name == github.repository &&
github.event.pull_request.user.login != 'dependabot[bot]' &&

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.

🟠 Dependabot/actor check misses variants and can block PRs (risk)

If a Dependabot PR arrives as dependabot-preview[bot] or with github.actor not equal to dependabot[bot] (e.g., renovate[bot] or a human acting for Dependabot), REVIEW_ELIGIBLE will be true. The job will then reach Require OPENROUTER_API_KEY with an empty org secret (forks/Dependabot get no secret) and exit 1, failing the required workflow and blocking the PR forever — the exact outcome the REVIEW_ELIGIBLE gate was meant to prevent.

Evidence: .github/workflows/openrouter-code-review.yml:56-61 checks only github.event.pull_request.user.login != 'dependabot[bot]' && github.actor != 'dependabot[bot]'. No endsWith('[bot]') or dependabot substring test, and no renovate handling. Sibling grok has no eligibility gate at all, so this is the only guard.

Checked via grep OPENROUTER and grep dependabot — only those two lines reference the actor. No tests inventorying eligible actors were found. Could not prove Dependabot never uses the preview name in this org, so retain finding; consider contains(..., 'dependabot') or endsWith(..., '[bot]') and document scope.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not applicable. dependabot-preview[bot] has not existed for years, and Dependabot PRs always present both user.login and github.actor as dependabot[bot], which is what the gate checks. Renovate and other GitHub App PRs are same-repo branches and do receive org secrets, so they are reviewed normally. The only no-secret cases are forks and Dependabot, both handled.


- name: Checkout PR head
if: env.REVIEW_ELIGIBLE == 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

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.

🔵 actions/checkout pin comment # v7.0.1 unverifiable and diverges from the sibling's v4.2.2 pin (nit)

The SHA 3d3c42e5aac5ba805825da76410c181273ba90b1 is annotated # v7.0.1, but nothing in this repo can confirm the SHA↔version mapping, and the otherwise-parallel sibling grok-code-review.yml pins a much older 11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2. If the annotation is wrong, future supply-chain audits and version bumps keyed off the comment would be mistaken about what revision is actually running. Worth a quick confirmation that the SHA really is the v7.0.1 tag (or that the comment should say something else) before merge.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Verified: refs/tags/v7.0.1 in actions/checkout resolves to 3d3c42e5aac5ba805825da76410c181273ba90b1, so the annotation is correct. The Grok sibling pins an older v4.2.2 SHA, which is a candidate for a separate bump.

Review triage of the first-pass findings on this PR:

- Valid: gh pr view on workflow_dispatch ran with no checkout and no
  GH_REPO, so gh could not resolve the repository. Set GH_REPO, validate
  pr_number and the resolved SHA, and only resolve when eligible.
- Valid in spirit: ruleset-triggered runs ignore the types filter and
  fire only on opened/synchronize/reopened, and a skipped job leaves the
  required check unsatisfied. The job now always runs and succeeds;
  eligibility gates the steps. Drafts are reviewed rather than skipped,
  because ready_for_review never arrives from the ruleset and the action
  refuses a latest-commit round with no prior ledger.
- Accepted as cheap hygiene: pin max_tool_turns 50 on the first pass, pin
  judge_model explicitly, timeout 30 to match the Grok sibling.
- Not valid: the checkout SHA is the actions/checkout v7.0.1 tag; the
  action inputs and outputs are as documented at the pinned revision;
  dependabot-preview[bot] no longer exists and Renovate PRs receive
  org secrets; the read-only tool sandbox is the action's documented
  design.

Co-Authored-By: Claude Fable 5.1 <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.

OpenRouter pull-request review

Verdict: issues
Scope: latest-commit (commit-range)
Mode: verify
Commit: b47554c5ac28531fc65c3613c8b69c4e39f1de64
Judge: openai/gpt-5.6-luna (repaired(canonical+1): source coverage preserved before publication cap)
Cost: $0.0854 (lanes $0.0849 + judge $0.0006)

Lanes

  • meta/muse-spark-1.2: ok (0 finding(s), 59.3s, 38347+5390 tokens (6769 cached), 3 tool round(s), via Meta, $0.0634)
  • z-ai/glm-5.3-flash: ok (1 finding(s), 216.6s, 121751+27184 tokens (82944 cached), 6 tool round(s), via Parasail, $0.0215)

Round 2 resolution

  • ✅ r1-1 fixed correctly — First-pass review missing explicit tool-round budget: First-pass now sets max_tool_turns: "50" explicitly (line ~136) matching header comment and PR body; follow-up keeps 30. Verified in .github/workflows/openrouter-code-review.yml.
  • ✅ r1-2 fixed correctly — workflow_dispatch runs always fail: gh pr view runs without -R/GH_REPO in an empty workspace: Resolve PR head now sets GH_REPO=${{ github.repository }} (line ~88) so gh pr view resolves without checkout, validates pr_number is positive integer before call, and validates 40-hex SHA after. Addresses empty-workspace dispatch failure.
  • ✅ r1-3 fixed correctly — Draft PRs skip entire job, may not satisfy required-workflow check: Job-level if: on draft removed; job always runs and only steps are gated by REVIEW_ELIGIBLE. REVIEW_ELIGIBLE no longer checks draft, header updated to 'Drafts are reviewed like any other PR'. Job no longer skips as required-check.
  • 🤝 r1-4 disputed — workflow_dispatch SHA resolution can hard-fail the required check: The claimed harm does not hold on the normal path: a workflow_dispatch run executes on the dispatch ref's commit (typically the default-branch tip), not the PR head commit, so its failed "OpenRouter review" check run is not the check the ruleset evaluates for the PR — a mistyped pr_number, a deleted PR, or a throttled API reddens only the admin-triggered run itself and does not block merging. …
  • 🤝 r1-5 disputed — Dependabot/actor check misses variants and can block PRs: The concrete scenarios do not hold against current GitHub behavior. Real Dependabot PRs always present user.login and github.actor as dependabot[bot] (both excluded at lines 68–69), and Dependabot runs are precisely the ones that cannot access Actions secrets — so the gate covers the only genuine no-secret case. renovate[bot] PRs are same-repo pull_request events from a GitHub App whose …
  • ❌ r1-6 not fixed — Pinned action's input/output contract and claimed behavior are unverifiable from this repo; mismatches degrade silently: Nothing landed verifies the pinned action's contract, and the change expands the unverifiable surface: judge_model: ${{ env.OR_JUDGE }} (line 130, 148) and max_tool_turns: "50" (line 136) are new assumptions, and the Summary now prints a Judge row from OR_JUDGE regardless of what the action actually used. If FlyOverCoderKY/openrouter-pr-review-action@​4471f596 does not define those inputs…
  • 🤝 r1-7 disputed — Untrusted PR content reviewed by an agent holding pull-requests: write and the org OpenRouter key: Workflow still grants pull-requests: write + OPENROUTER_API_KEY to the review action and checks out PR head – required to post reviews. 'Read-only tool rounds' is an action-side claim not enforceable from workflow YAML; mitigation already present is minimal permissions (contents:read, pull-requests:write, persist-credentials:false), SHA pin, and fail_on:never. Further containment would require act…
  • ✅ r1-8 fixed correctly — timeout-minutes: 25 below the sibling's 30 for a comparable first pass; a timed-out run fails the required check and blocks merge: timeout-minutes raised from 25 to 30 (line ~52), matching sibling grok-code-review.yml, removing the runner-timeout failure mode for the 50-turn first pass.
  • 4 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is risk).
  • Open findings after this round: 2 (0 bug-severity).

Findings

🔵 Issue 1 — Header claims the job "always runs and always succeeds", contradicted by the file's own exit-1 steps

.github/workflows/openrouter-code-review.yml:16 · nit · identified by z-ai/glm-5.3-flash

The new comment block asserts "The job always runs and always succeeds; only the review steps are gated." That is the file's only documentation of the safety contract an org admin relies on when pointing the merge ruleset at it, and it is false for eligible runs.

Concrete scenario: the org-level OPENROUTER_API_KEY is deleted, renamed, or its visibility is narrowed. Every same-repo PR in every pegma-dev repo then fails at Require OPENROUTER_API_KEY (lines 84–87), so the ruleset-required check goes red and blocks all of them — exactly the deadlock the redesign was meant to preclude for forks/Dependabot. Likewise Resolve PR head (lines 99–110) hard-fails the job on a mistyped pr_number or an unresolvable PR on workflow_dispatch.

The failing steps themselves predate this diff and are a deliberate fail-loud choice, so this is a comment-accuracy issue, not a behavior regression: the exit paths were already present in the base file, and only the "always succeeds" sentence is newly introduced and clearly wrong.

Workflow run

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

Grok Grok Build Review

The workflow is suitable as an organization-required check in its access-control shape: fork and Dependabot events keep the job on a success path, the org secret is not demanded on those paths, and the action reference is a full commit SHA. The first-pass and follow-up split is not consistent with the constraint recorded in this file that a latest-commit follow-up is refused when no initial review exists. A synchronize run is allowed to start while the opened first pass is still in progress, which is the normal sequence on a new pull request.

🐞 0 bugs · ⚠️ 1 warnings · 🤏 0 nits

Reviewed commit b47554c · workflow run

Round 2 triage: Grok's warning is correct that a synchronize arriving
while the opened first pass is still running would start a follow-up
that the action refuses for lack of a ledger. Use one concurrency group
per PR with cancel-in-progress off so the follow-up waits; GitHub keeps
only the newest pending run and a latest-commit round covers the whole
unreviewed range. GLM's nit is correct that "always succeeds" was false
when the org secret is empty; that case now warns and skips so a
reviewer outage cannot block every merge in the organization.

Co-Authored-By: Claude Fable 5.1 <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.

OpenRouter pull-request review

Verdict: issues
Scope: latest-commit (commit-range)
Mode: verify
Commit: 86e8c83627897ad9ea6abedaf61d297f4f4bb4ae
Judge: openai/gpt-5.6-luna
Cost: $0.0905 (lanes $0.0886 + judge $0.0019)

Lanes

  • meta/muse-spark-1.2: ok (0 finding(s), 44.4s, 48857+3930 tokens (8689 cached), 4 tool round(s), via Meta, $0.0682)
  • z-ai/glm-5.3-flash: ok (2 finding(s), 298.0s, 66364+26481 tokens (23040 cached), 4 tool round(s), via Parasail, $0.0204)

Round 3 resolution

  • ❌ r1-6 not fixed — Pinned action's input/output contract and claimed behavior are unverifiable from this repo; mismatches degrade silently: No contract verification added. Workflow still pins FlyOverCoderKY/openrouter-pr-review-action@​4471f5963751223c26a2e169d78c0f13817165aa and assumes inputs models/judge_model/review_scope/review_mode/max_tool_turns/status_comments/roast_level/fail_on/github_token/pr_number and outputs verdict/issue_count/review_url plus header claims (default judge openai/gpt-5.6-luna, union-merge) without any …
  • 1 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is risk).
  • Open findings after this round: 3 (0 bug-severity).

Findings

🟠 Issue 1 — Merged concurrency group can cancel a queued first pass and leave the PR's full review permanently skipped

.github/workflows/openrouter-code-review.yml:55 · risk · identified by z-ai/glm-5.3-flash

A pull_request: opened run for a same-repo PR queues but has not yet started (runner contention is normal for an org-wide required workflow). A synchronize event then queues into the same group. GitHub keeps only the newest pending run per concurrency group, so the queued first pass is cancelled and never runs; the synchronize run starts with IS_FOLLOW_UP: 'true' and review_scope: latest-commit against a PR that has no review ledger. Per this file's own header (line 27), "a latest-commit follow-up is refused when no initial review exists", so the full-PR review never happens — and no later event repairs it, because every subsequent push fires another synchronize follow-up, also refused. The review is silently missing (or, if the action's refusal exits non-zero, the required check goes red on replayable synchronize events and re-runs keep failing). The new header's safety argument (lines 32–36) only covers the case where the first pass is running ("a synchronize that lands while the first pass is still running waits for it"); the pending-not-yet-started case is exactly the hole, and it directly falsifies line 36's claim that "superseded pending runs lose nothing".

Mechanism: the old design (grok-code-review.yml line 33 shape, and this file's previous version) split the group by pass type, so an opened first pass and a synchronize follow-up ran in different groups — the first pass always executed and wrote the ledger. Merging into openrouter-code-review-<repo>-<pr> with cancel-in-progress: false (lines 54–56) makes first-pass and follow-up runs compete for the single newest-pending slot, so a follow-up can now cull a not-yet-started first pass. The workflow_dispatch re-review path has the same exposure (a dispatch's first pass pending while someone pushes).

Repair direction: gate the follow-up step on an existing initial review (fall back to full-pr when none exists), or keep pass-type-separated groups and handle the in-flight-first-pass race explicitly. A plain revert to split groups reintroduces the concurrent-ledgerless-follow-up race the author was fixing, so the ledger check is the durable fix.

What I checked: group identity for both events is identical (github.event.pull_request.number present on both); IS_FOLLOW_UP is computed per-event, so the queued synchronize run is a follow-up; no other step re-triggers a first pass. Proof gap: whether a ledgerless follow-up degrades to a green skip or a red check depends on the pinned action's refusal semantics, which cannot be verified from this repo — but under the file's own stated model the first pass is lost either way.

🟠 Issue 2 — New header overstates the job's hard-failure envelope; reviewer outages and infra failures can still red-check every PR

.github/workflows/openrouter-code-review.yml:19 · risk · identified by z-ai/glm-5.3-flash

The newly added header lines 16–21 assert: "The only hard failures are a malformed pr_number or an unresolvable PR head, which can only happen on a manual dispatch and therefore never touch a pull request's required check", immediately after claiming "a reviewer outage must not block every merge in the organization". That safety envelope is not what the workflow implements:

  • The only new resilience is the missing-secret warn-and-skip (lines 87–101). An OpenRouter outage with the secret present still runs the review steps; if the action exits non-zero, the required check goes red for every open PR in the org, which is precisely the outcome the header says cannot happen.
  • timeout-minutes: 30 (line 62) hard-fails the job on any event if the 50-tool-round, two-model-plus-judge first pass overruns — a framework-guaranteed red check on a normal pull_request run.
  • actions/checkout (line 127) can fail on a pull_request event (transient network error, or the event-time head SHA becoming unfetchable after a force-push while the run waits — a window this diff widens by serializing runs with cancel-in-progress: false).

For an org ruleset that requires this workflow, any of these red-checks merges org-wide, which is the exact failure mode the header says cannot happen. The named dispatch-only failures are real, but they are not the complete hard-failure surface.

What I checked: the two exit 1 paths in Resolve PR head indeed cannot fire on pull_request events (the event always carries head.sha), so the sentence is true only for those two deliberate failures — it is the exhaustive framing plus the outage claim that is wrong. Proof gap: whether fail_on: never swallows reviewer-outage exits depends on the pinned action's behavior, which is unverifiable from this repo (see r1-6); the timeout and checkout paths are framework guarantees and stand on their own.

Workflow run

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

Grok Grok Build Review

The workflow is otherwise aligned with an organization-required check: the job always runs, ineligible fork and Dependabot events skip without failing, and findings are not used as a merge gate. The first-pass and follow-up split is not sound under GitHub concurrency. A still-queued opened run is discarded when a synchronize event arrives, and the surviving run is forced to latest-commit, which this file states is refused when no ledger exists. That race leaves pull requests without an initial review while the required check can still complete successfully.

🐞 1 bugs · ⚠️ 0 warnings · 🤏 0 nits

Reviewed commit 86e8c83 · workflow run

Round 3 triage: both reviewers found the same hole in the single
concurrency group. GitHub keeps only the newest pending run per group,
so a still-queued opened run is discarded by a synchronize, and the
survivor would run latest-commit with no ledger, which the action
refuses. Scope now comes from the PR itself: a synchronize run narrows
to latest-commit only when the bot has already posted a ledger marker
on the PR, otherwise it performs the initial full-PR review. The two
review steps collapse into one, and bot_login is passed explicitly so
the ledger scan and the action agree on the posting identity.

The header now states the real hard-failure envelope (timeout, checkout,
or the action itself failing) instead of claiming those cannot happen.

Co-Authored-By: Claude Fable 5.1 <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.

OpenRouter pull-request review

Verdict: issues
Scope: latest-commit (commit-range)
Mode: verify
Commit: 765c36e9fa2285bebab2d7e692729492c9353e0e
Judge: openai/gpt-5.6-luna
Cost: $0.0796 (lanes $0.0777 + judge $0.0019)

Lanes

  • meta/muse-spark-1.2: ok (0 finding(s), 36.0s, 53031+3299 tokens (27475 cached), 4 tool round(s), via Meta, $0.0501)
  • z-ai/glm-5.3-flash: ok (3 finding(s), 634.1s, 85373+35935 tokens, 2 tool round(s), via Parasail, $0.0276)

Round 4 resolution

  • 🤝 r1-6 disputed — Pinned action's input/output contract and claimed behavior are unverifiable from this repo; mismatches degrade silently: Contract cannot be proved from inside this repo by design. Fixing agent verified externally that every input/output used here (models, judge_model, review_scope, review_mode, fail_on, roast_level, status_comments, max_tool_turns, github_token, pr_number, bot_login and outputs verdict/issue_count/review_url) is defined in action.yml at FlyOverCoderKY/openrouter-pr-review-action@​4471f596 and that th…
  • ✅ r3-1 fixed correctly — Merged concurrency group can cancel a queued first pass and leave the PR's full review permanently skipped: Fixed in 765c36e. Scope is now ledger-based, not event-based: Resolve step queries repos/:repo/pulls/:number/reviews for reviews by BOT_LOGIN=github-actions[bot] containing LEDGER_MARKER='<!-- openrouter-review-ledger:v1:' and sets SCOPE=latest-commit only when count>0, otherwise full-pr. Concurrency is one group per PR with cancel-in-progress:false so the surviving queued synchronize run does the…
  • ✅ r3-2 fixed correctly — New header overstates the job's hard-failure envelope; reviewer outages and infra failures can still red-check every PR: Header rewritten (lines 16-21). No longer claims only malformed pr_number/unresolvable SHA can fail. Now explicitly states what can still turn the required check red: job timeout, checkout failure, or the action itself failing (e.g. every lane/retry failing during an OpenRouter outage), notes this is accepted with admin bypass and fail_on: never remains non-gating.
  • Open findings after this round: 3 (1 bug-severity).

Findings

🔴 Issue 1 — Ledger probe uses env.* inside gh api --jq; gh's jq cannot resolve env, so every synchronize run hard-fails the required check

.github/workflows/openrouter-code-review.yml:128 · bug · identified by z-ai/glm-5.3-flash

The new scope-selection block runs, for every synchronize of an eligible same-repo PR, a probe that references env.BOT_LOGIN and env.LEDGER_MARKER inside a gh api --paginate ... --jq filter. gh's --jq is evaluated by gojq without an environment loader, so env (and $ENV) are not defined in that context — the documented workaround has always been to interpolate the values in the shell. If gojq rejects env at compile time as expected, gh exits non-zero; because the step runs under set -euo pipefail, the LEDGERS="$(gh ... | awk ...)" assignment fails and the "Resolve PR head and review scope" step fails outright. With the org ruleset requiring this workflow, the required check goes red on every push to every eligible PR in the organization — precisely the merge-blocking failure this workflow was written to avoid — and the header's accepted-failure list (timeout, checkout failure, action failing) does not cover it.

The failure is deterministic, not transient: it fires on the first synchronize after this commit lands, org-wide. This also undermines the r3-1 fix's operative step, since the ledger probe is what decides the scope.

What I checked and could not: I cannot execute gh in this review to reproduce the gojq compile error, and run logs are not observable from the inert checkout. Proof gap: if a synchronize run of this workflow on this very PR (head 765c36e) completed green with scope resolution, that disproves the mechanism. Even if env happens to resolve, the probe is still fragile: a transient GitHub API failure fails the step outright (pipefail is on), which the header does not list. Fix that works either way: interpolate the values in the shell (or fetch review bodies and count in bash), and decide explicitly whether a probe failure should fall back to full-pr instead of failing the check.

🟠 Issue 2 — New unverified action contract: bot_login input, LEDGER_MARKER body marker, and posting identity assumed from the pinned action

.github/workflows/openrouter-code-review.yml:163 · risk · identified by z-ai/glm-5.3-flash

This commit adds contract assumptions about FlyOverCoderKY/openrouter-pr-review-action@​4471f596 that nothing in this repo (and nothing in the fixing agent's verification) covers:

  • bot_login: ${{ env.BOT_LOGIN }} is a brand-new input (line 163). The external verification reply lists the action's inputs as models, judge_model, review_scope, review_mode, fail_on, roast_level, status_comments, max_tool_turns, github_token, pr_number — bot_login is absent from that list, and if it is not defined in the action's action.yml the runner only logs an "unexpected input" warning and the action runs without it.

  • LEDGER_MARKER: "<!-- openrouter-review-ledger:v1:" (line 67) is a literal embedded in review bodies, not an input/output, so verifying action.yml inputs/outputs cannot confirm it. If the action's actual marker string or version differs, the probe always returns 0 and every synchronize silently reruns a full 50-turn review; the follow-up lane never engages and nothing signals the degradation.

  • The probe also assumes reviews are posted by github-actions[bot] (true for github.token) and appear in pulls/{n}/reviews rather than as issue comments.

Converse risk worth checking with the action author: if the action can emit a marker-bearing review body even when its run errored (e.g. a verdict of n/a posted before failing), a later latest-commit run would narrow against a ledger whose initial full review never completed, leaving earlier commits permanently unreviewed.

This is the same degrade-silently mechanism as r1-6; the reply's external verification (pre-dating this commit) does not cover the new surface.

🔵 Issue 3 — Header comment misstates scope selection: the event type still gates the ledger check

.github/workflows/openrouter-code-review.yml:17 · nit · identified by z-ai/glm-5.3-flash

The new header asserts "The ledger check, not the event type, decides". The code does not do that: the ledger probe only runs when EVENT_ACTION = synchronize (line 124). An opened, reopened, or manual workflow_dispatch run on a PR that already carries a bot ledger still runs full-pr with 50 turns, bypassing the ledger entirely. Runtime behavior is sensible (re-reviewing the whole PR on reopen/dispatch is fine), but the comment contradicts the implementation and will mislead whoever tunes this next — e.g. someone relying on the comment could add a second follow-up event type and expect narrowing that never happens.

Workflow run

with:
github_token: ${{ github.token }}
pr_number: ${{ steps.pr.outputs.number }}
bot_login: ${{ env.BOT_LOGIN }}

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.

🟠 New unverified action contract: bot_login input, LEDGER_MARKER body marker, and posting identity assumed from the pinned action (risk)

This commit adds contract assumptions about FlyOverCoderKY/openrouter-pr-review-action@​4471f596 that nothing in this repo (and nothing in the fixing agent's verification) covers:

  • bot_login: ${{ env.BOT_LOGIN }} is a brand-new input (line 163). The external verification reply lists the action's inputs as models, judge_model, review_scope, review_mode, fail_on, roast_level, status_comments, max_tool_turns, github_token, pr_number — bot_login is absent from that list, and if it is not defined in the action's action.yml the runner only logs an "unexpected input" warning and the action runs without it.

  • LEDGER_MARKER: "<!-- openrouter-review-ledger:v1:" (line 67) is a literal embedded in review bodies, not an input/output, so verifying action.yml inputs/outputs cannot confirm it. If the action's actual marker string or version differs, the probe always returns 0 and every synchronize silently reruns a full 50-turn review; the follow-up lane never engages and nothing signals the degradation.

  • The probe also assumes reviews are posted by github-actions[bot] (true for github.token) and appear in pulls/{n}/reviews rather than as issue comments.

Converse risk worth checking with the action author: if the action can emit a marker-bearing review body even when its run errored (e.g. a verdict of n/a posted before failing), a later latest-commit run would narrow against a ledger whose initial full review never completed, leaving earlier commits permanently unreviewed.

This is the same degrade-silently mechanism as r1-6; the reply's external verification (pre-dating this commit) does not cover the new surface.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Verified against the pinned revision: bot_login is a declared input in action.yml (default github-actions[bot]), the marker literal is LEDGER_PREFIX in src/or_pr_review/loop.py (<!-- openrouter-review-ledger:v1:), ledger state is read from pulls/{n}/reviews bodies authored by bot_login (github_ops.list_bot_review_bodies), and per the README a failed or partial initial review does not publish authoritative loop state. Round 4 also exercised the probe end to end on this PR.

Round 4 triage: the env-in-jq claim is disproved by the round 4 run
itself, which was a synchronize on 765c36e and resolved latest-commit
scope. The fragility point stands, so a probe failure now warns and
falls back to the full-PR review instead of failing the required check.
The header no longer says the ledger decides for every event; only a
synchronize consults it.

Co-Authored-By: Claude Fable 5.1 <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.

OpenRouter pull-request review

Verdict: issues
Scope: latest-commit (commit-range)
Mode: verify
Commit: 9daea4b5225657cf6f9c5cd4f480e4269fde0050
Judge: openai/gpt-5.6-luna
Cost: $0.0853 (lanes $0.0851 + judge $0.0001)

Lanes

  • meta/muse-spark-1.2: ok (0 finding(s), 45.0s, 45903+4699 tokens (4849 cached), 4 tool round(s), via Meta, $0.0720)
  • z-ai/glm-5.3-flash: ok (0 finding(s), 189.9s, 58827+17454 tokens (36864 cached), 3 tool round(s), via Parasail, $0.0131)

Round 5 resolution

  • ✅ r4-1 fixed correctly — Ledger probe uses env.* inside gh api --jq; gh's jq cannot resolve env, so every synchronize run hard-fails the required check: Probe no longer hard-fails the required check. 9daea4b adds || true inside the command substitution and validates LEDGERS with [[ ! "${LEDGERS}" =~ ^[0-9]+$ ]] -> warn and LEDGERS=0, falling back to full-pr. Even if gh api --jq 'env.BOT_LOGIN' were to fail/emit non-numeric, the step now warns and does the always-valid full-PR review instead of exiting non-zero under set -euo pipefail. …
  • ❌ r4-2 not fixed — New unverified action contract: bot_login input, LEDGER_MARKER body marker, and posting identity assumed from the pinned action: No change to the new contract: uses: FlyOverCoderKY/openrouter-pr-review-action@​4471f596 still receives bot_login: ${{ env.BOT_LOGIN }} (line 170) and the ledger probe still assumes reviews are posted as github-actions[bot] containing LEDGER_MARKER. No file in this repo verifies bot_login exists in the external action.yml, and the cited external verification for r1-6 explicitly lists i…
  • 1 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is risk).
  • Open findings after this round: 1 (0 bug-severity).

No structured findings from the successful lane(s).

Workflow run

@FlyOverCoderKY
FlyOverCoderKY merged commit 85774df into main Sep 10, 2026
2 checks passed
@FlyOverCoderKY
FlyOverCoderKY deleted the openrouter-org-review branch September 10, 2026 02:02
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