Skip to content

ci: enable automatic AI review for PR authors with write access - #6419

Merged
Coly010 merged 2 commits into
developfrom
ci/ai-review-enable-auto-trigger
Sep 1, 2026
Merged

Coly010 merged 2 commits into
developfrom
ci/ai-review-enable-auto-trigger

Conversation

@Coly010

@Coly010 Coly010 commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Ends the AI review pipeline's shadow mode: the pull_request trigger (opened / ready_for_review) in ai-review.yml is now live, so every qualifying PR gets its one-shot Claude + Codex review automatically.

The automatic path is gated to internal contributors. On top of the existing draft/bot/fork skips, resolve.ts now resolves the PR author's effective repository permission and requires write/admin (the same WRITE_PERMISSIONS gate the manual /ai-review path already uses) before running. This lookup is the authoritative author check — a same-repo head branch only proves the branch exists in the repo, not that the author pushed it — and an unresolvable permission counts as unauthorized. External contributors' PRs are never reviewed automatically; a maintainer comments /ai-review to request one, exactly as before.

The gate runs before the dedup listing (one permission lookup instead of two paginated list calls), and PrDetails now carries the author's login so the resolver can do the lookup. The README's rollout section is rewritten to document the live trigger and the note that the Codex GitHub App's automatic reviews must stay disabled so PRs aren't double-reviewed.

Two fixes surfaced by this PR's own live run:

  • Fresh reviews no longer supersede themselves. postConsolidatedReview listed reviews after posting, so the just-posted review (a marker-bearing bot review) was swept into its own supersede pass and every new review immediately collapsed as "Superseded by a newer AI review". The prior runs are now snapshotted before the POST, and the test fake mirrors real GitHub by including posted reviews in later listings.
  • Auto runs get their own concurrency group. pull_request events now use a per-PR auto group instead of sharing the manual review group, so a ready_for_review event (whose run may resolve to a skip) can never cancel an in-flight maintainer-requested review.

🤖 Generated with Claude Code

Uncomment the pull_request (opened/ready_for_review) trigger and gate the
automatic path in resolve.ts to PR authors whose effective repository
permission is write/admin, mirroring the manual /ai-review path's
WRITE_PERMISSIONS gate. External contributors' PRs are skipped and keep
going through the manual /ai-review maintainer path.
@Coly010
Coly010 requested a review from a team as a code owner September 1, 2026 10:28
@Coly010 Coly010 self-assigned this Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase/cli/supabase@d9916cad114733e21282c639ed363c82a09e4253

Preview package for commit d9916ca.

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

Superseded by a newer AI review

🤖 AI Review

Both independent reviews completed. Claude reported five findings and Codex reported none. Code inspection confirms four findings (two minor issues and two nits) and refutes the permission-error finding because the shared helper explicitly treats non-404 failures as fatal by design.

Findings

Severity Location Category Sources Claim
🟡 MINOR .github/workflows/ai-review.yml:25 ci-concurrency claude Automatic pull-request events share the manual review concurrency group, allowing a ready-for-review event to cancel an in-flight maintainer-requested review even when the automatic run subsequently skips.
🟡 MINOR .github/ai-review/README.md:171 documentation claude The documentation overstates that the write-capable job runs exclusively trusted code: a pull_request run uses the PR's workflow definition, so pinning the job's checkout to develop does not itself prevent workflow-level changes from altering that job.
⚪ NIT .github/scripts/ai-review/resolve.ts:194 documentation claude The comment incorrectly says a same-repository head branch implies the PR author could push; a PR author can open a pull request between branches they did not create or push, making the permission lookup authoritative rather than merely defense in depth.
⚪ NIT .github/ai-review/README.md:36 formatting claude The edited resolver description introduces the only prose line in the file exceeding the surrounding 80-column wrapping convention.
Refuted findings (kept for transparency, not posted as review comments)
  • .github/scripts/ai-review/resolve.ts:200 (error-handling): Non-404 failures while resolving the PR author's permission fail the resolve job instead of being treated as unauthorized skips.
    Refuted: Although non-404 errors do propagate, the shared helper explicitly defines and documents this as intentional behavior so transient failures remain visible. In this code, “unresolvable permission” means the helper's undefined result, not an operational API failure.

Stats

Claude findings: 5 · Codex findings: 0 · Confirmed: 4 · Refuted: 1 · Uncertain: 0


Models: claude-opus-5 + gpt-5.6-sol · Trigger: auto · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

Comment thread .github/workflows/ai-review.yml Resolved
Comment thread .github/ai-review/README.md Resolved
Comment thread .github/scripts/ai-review/resolve.ts Resolved
Comment thread .github/ai-review/README.md Resolved
… findings

The supersede pass listed reviews AFTER posting, so the just-posted review
(a marker-bearing bot review) was swept into its own supersede pass and
every fresh review immediately collapsed as 'Superseded by a newer AI
review'. Snapshot the prior runs before the POST instead, and make the test
fake mirror real GitHub by including posted reviews in later listings.

Also addresses the AI review findings on this PR: pull_request runs get
their own per-PR concurrency group so a ready_for_review event can't cancel
an in-flight maintainer-requested review; the write-access lookup is
documented as the authoritative author check (a same-repo branch doesn't
prove the author pushed it); the post-review trusted-code claim now
acknowledges that pull_request events execute the PR ref's workflow file
and why that's safe; README line rewrapped to the 80-column convention.
@Coly010
Coly010 enabled auto-merge September 1, 2026 10:59
@Coly010
Coly010 added this pull request to the merge queue Sep 1, 2026
Merged via the queue into develop with commit 9a469f7 Sep 1, 2026
66 of 70 checks passed
@Coly010
Coly010 deleted the ci/ai-review-enable-auto-trigger branch September 1, 2026 11:13
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.

2 participants