Skip to content

ci: add the owner-triggered PR review workflow - #35

Merged
luckyPipewrench merged 3 commits into
mainfrom
chore/ai-pr-review
Jul 25, 2026
Merged

luckyPipewrench merged 3 commits into
mainfrom
chore/ai-pr-review

Conversation

@luckyPipewrench

@luckyPipewrench luckyPipewrench commented Jul 25, 2026 •

Copy link
Copy Markdown
Member

What this does

Adds the owner-triggered review workflow this repository was missing. A /review deep comment here previously did nothing at all, because the workflow that handles it only ever existed in the main repository. The comment simply sat there unread, so pull requests here have only ever had a single review lane.

Supported commands: /review, /review deep, /review tests, /review docs.

Differences from the main repository's copy

The Go-specific stats mode is dropped. It shelled out to a Go test that does not exist here.

That removal is also a security improvement. Stats mode was the only mode that checked out and executed pull-request code inside the job holding the API key, which is why the trigger carries an owner gate. With it gone, no pull-request-controlled code runs in that scope at all and the runner is always checked out from the default branch. The owner gate is kept regardless, since the job still holds a key.

The three prompts are rewritten. The originals described a network proxy and asked about transports, sandbox boundaries and tool poisoning, none of which apply to a verifier library. They now describe a package whose defining property is byte-exact parity with the Go emitter, and they ask for the failure modes that parity work actually produces: divergence in the canonical projection, accepting a shape the emitter would reject, rejecting one it would accept, parser-differential surfaces, and guards that no test would catch the removal of.

The test prompt leads with the question of whether a test would fail if the thing it guards were deleted. That specific check is what caught a guard passing an entire suite while removed.

Also

Adds scripts to the lint and format paths, so the new file is checked rather than silently skipped.

Required before it works

The OPENAI_API_KEY repository secret has to be set. Without it the workflow will run and fail at the review step. Everything else is self-contained.

The dependency pins are copied byte for byte from the main repository and install under hash verification.

Summary by CodeRabbit

  • New Features

    • Added an AI-powered pull request review workflow.
    • Reviewers can request standard, deep, test-focused, or documentation-focused reviews through supported commands.
    • Automated reviews are posted directly to pull requests, with clear error messages when review generation fails.
  • Chores

    • Added deterministic, hash-verified dependencies for the review workflow.
    • Expanded CI linting and formatting checks to include script files.

Ports the /review, /review deep, /review tests and /review docs commands that the main repo has had, so a comment on a pull request here actually triggers a review instead of sitting unread.

The Go-specific stats mode is dropped. It shelled out to a Go test that does not exist in this repository, and it was also the only mode that checked out and executed code from the pull request inside the job that holds the API key. Removing it means no pull-request-controlled code runs in that scope at all, and the runner is always checked out from the default branch.

The three review prompts are rewritten for what this package actually is. The generic ones described a network proxy and asked about transports and sandbox boundaries, none of which exist here. They now describe a verifier whose defining property is byte-exact parity with the Go emitter, and they ask for the failure modes that parity work actually produces: divergence in the canonical projection, accepting a shape the emitter would reject, rejecting one it would accept, parser-differential surfaces, and guards no test would catch the removal of.

The test prompt leads with whether a test would fail if the thing it guards were deleted, because a guard that passes either way reports safety it does not provide.

Adds scripts to the lint and format paths so the new file is covered rather than silently unchecked.

The dependency pins are copied byte for byte from the main repo and install under hash verification.
@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@luckyPipewrench, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 882d1f3a-0cad-4fd5-a1c0-9aec1843ae77

📥 Commits

Reviewing files that changed from the base of the PR and between d9c3af7 and b5acb1c.

📒 Files selected for processing (2)
  • .github/workflows/pr-review.yaml
  • scripts/pr-review.py
📝 Walkthrough

Walkthrough

Adds an owner-triggered GitHub Actions workflow for AI pull request reviews, a Python implementation that retrieves diffs and posts LLM-generated comments, hash-pinned dependencies, and Ruff coverage for the scripts directory.

Changes

AI PR Review

Layer / File(s) Summary
Review configuration and prompts
scripts/pr-review.py
Defines review modes, model configuration, prompts, error handling, and standalone execution.
Diff, LLM, and comment processing
scripts/pr-review.py
Fetches and truncates PR diffs, builds LLM requests, validates responses, and posts review or error comments.
Workflow installation and CI coverage
.github/workflows/pr-review.yaml, .github/requirements-pr-review.txt, .github/workflows/ci.yml
Adds owner-only comment triggers, installs hash-pinned dependencies, passes review settings to the script, and includes scripts in Ruff checks.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Owner
  participant GitHubActions
  participant pr_review.py
  participant GitHubAPI
  participant LLM
  Owner->>GitHubActions: post supported review command
  GitHubActions->>pr_review.py: pass PR and review configuration
  pr_review.py->>GitHubAPI: fetch PR diff
  GitHubAPI-->>pr_review.py: return diff
  pr_review.py->>LLM: submit review prompt and diff
  LLM-->>pr_review.py: return review text
  pr_review.py->>GitHubAPI: post PR comment
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding an owner-triggered PR review workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/ai-pr-review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pr-review.yaml:
- Line 31: Update the checkout step’s ref configuration in the workflow to
resolve the repository’s actual default branch dynamically instead of
hard-coding refs/heads/main, while preserving the existing checkout behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b5eca076-7993-424f-abb5-c2b18a1f5fce

📥 Commits

Reviewing files that changed from the base of the PR and between 329f1c7 and d9c3af7.

📒 Files selected for processing (4)
  • .github/requirements-pr-review.txt
  • .github/workflows/ci.yml
  • .github/workflows/pr-review.yaml
  • scripts/pr-review.py

Comment thread .github/workflows/pr-review.yaml Resolved
The self-scan flags any assignment whose name begins with a credential word, regardless of whether a URL is involved, so api_key = openai_key and token = os.environ.get(...) both read as a credential in a URL. Renaming the locals clears it without excluding the file or relaxing the scan.
The runner was pinned to a hard-coded branch name, so renaming the default branch would break the workflow silently. It now reads the repository's own default branch from the event payload. That value is repository-controlled rather than pull-request-controlled, so the reason the runner is not checked out from the pull request still holds.
@luckyPipewrench
luckyPipewrench merged commit fc16c53 into main Jul 25, 2026
14 checks passed
@luckyPipewrench
luckyPipewrench deleted the chore/ai-pr-review branch July 25, 2026 01:23
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