Skip to content

feat(code-review): add opt-in block_on_severity merge gate - #2

Merged
starknetdev merged 1 commit into
mainfrom
feat/block-on-severity
Jul 29, 2026
Merged

feat(code-review): add opt-in block_on_severity merge gate#2
starknetdev merged 1 commit into
mainfrom
feat/block-on-severity

Conversation

@starknetdev

Copy link
Copy Markdown
Member

Summary

Reviews are advisory in this workflow: the only exit 1 paths are a missing config file and a non-zero exit from the codex CLI. A [CRITICAL] finding is posted as a comment and the build stays green.

That's a reasonable default, but it's a regression for repos migrating off hand-rolled review jobs. game-components' inline jobs ended with:

if echo "$BODY" | grep -qE '\[(CRITICAL|HIGH)\]'; then
  echo "::error::Review found CRITICAL or HIGH severity issues"
  exit 1
fi

So its port (Provable-Games/game-components#122) silently trades "a CRITICAL blocks merge" for "a CRITICAL is a comment".

Adds block_on_severity (default false) so a caller can opt back in, without imposing a gate on the four SDK repos that are happy with advisory reviews.

Behavior

  • Default falseno change for any existing caller. The step is if: always() && inputs.block_on_severity, so it doesn't even run unless opted in.
  • true → the review job fails when /tmp/review.txt contains [CRITICAL] or [HIGH]. Applies to both reviewers.
  • The gate runs after the comment upsert, so a blocking finding is always posted before the job goes red.
  • Guards on a non-empty review file, so a review that errored or produced no output cannot block on its own — that stays the job of the existing "Fail on Codex runtime error" step.

Verification

Gate logic exercised against realistic reviewer output:

review output result
[HIGH] src/a.ts:1 - bad BLOCK
[CRITICAL] a:1 - boom BLOCK
[MEDIUM] … / [LOW] … pass
lgtm pass
No review output was captured from Claude. pass
empty file pass
The word HIGH appears but not bracketed pass

The last row is the one worth calling out: matching is on the bracketed severity token, so prose mentioning "high severity" doesn't trip the gate.

Parsed with js-yaml to confirm the step lands in claude-review and codex-review and nowhere else. npx yaml@2.8.1 valid passes.

After merge

Backward-compatible, so v1 should move forward again — callers pin @v1 and won't see the input until it does.

Note the ordering constraint: passing an input a reusable workflow doesn't declare is a hard workflow error, so game-components#122 cannot set block_on_severity: true until v1 includes this. I'll wire it up once the tag moves.

🤖 Generated with Claude Code

Reviews are advisory here: the only failure paths are a missing config
file and a codex CLI crash, so a [CRITICAL] finding lands as a comment
and the build stays green. Repos migrating off hand-rolled review jobs
lose a gate they had — game-components' inline jobs ran
`grep -qE '\[(CRITICAL|HIGH)\]' && exit 1`.

Adds block_on_severity (default false) so a caller can opt back in
without imposing it on the repos that are happy with advisory reviews.
Applies to both reviewers.

The gate runs after the comment upsert, so a blocking finding is posted
before the job goes red, and guards on a non-empty review file so an
errored or empty review cannot block on its own.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@starknetdev
starknetdev merged commit cff3f95 into main Jul 29, 2026
starknetdev added a commit to Provable-Games/game-components that referenced this pull request Jul 29, 2026
Both depend on shared-workflow changes that have now landed at v1.

review-agents.json: the general agent goes back to the documented
diff_paths ["."] + exclude_paths ["packages/"]. The enumerated top-level
list was a workaround for the prefix matcher treating "." as a dotfile
prefix (fixed in Provable-Games/.github#1), and it silently missed any
new root file — LICENSE and docs/** matched no agent at all.

pr-ci.yml: block_on_severity: true restores the merge gate the inline
review jobs had (Provable-Games/.github#2). Without it a [CRITICAL]
finding would only post a comment.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
starknetdev added a commit to Provable-Games/game-components that referenced this pull request Jul 29, 2026
* chore(ci): delegate AI review to the org-shared reusable workflow

Replaces four hand-rolled review jobs (claude/codex x packages/general)
with a single call to Provable-Games/.github code-review.yml@v1. Review
logic, prompt assembly, comment upserting and model config now live in
one place, so a model deprecation is an org-variable change rather than
an edit here. This repo supplies only .github/review-agents.json plus
the existing .github/prompts/*.md.

Net -577 lines. Also drops the local AI-availability gate: the shared
workflow owns fork skipping, so the `changes` job no longer computes
can_run_ai_reviews and the pr-ci aggregate is back to a plain
did-any-job-fail check.

The general agent enumerates top-level paths rather than using the
documented ["."] catch-all: the shared workflow's matcher is prefix
based, so ["."] only matches dotfiles and would silently skip review on
README.md / Scarb.toml / codecov.yml-only PRs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* chore(ci): use the documented catch-all and restore the severity gate

Both depend on shared-workflow changes that have now landed at v1.

review-agents.json: the general agent goes back to the documented
diff_paths ["."] + exclude_paths ["packages/"]. The enumerated top-level
list was a workaround for the prefix matcher treating "." as a dotfile
prefix (fixed in Provable-Games/.github#1), and it silently missed any
new root file — LICENSE and docs/** matched no agent at all.

pr-ci.yml: block_on_severity: true restores the merge gate the inline
review jobs had (Provable-Games/.github#2). Without it a [CRITICAL]
finding would only post a comment.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* docs(ci): record why the review job pins @v1 and inherits secrets

Both were flagged as reproducibility/least-privilege risks in review.
Keeping them, deliberately: @v1 is the org convention every caller uses
and is what makes an upstream model change a one-place fix, and the
callee is first-party and declares exactly the two secrets it uses.
Pinning a SHA or enumerating secrets here would diverge from the other
six callers for no practical gain.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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