Repository navigation
ci: add the owner-triggered PR review workflow - #35
Conversation
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.
|
Warning Review limit reached
Next review available in: 48 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds 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 ChangesAI PR Review
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
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
.github/requirements-pr-review.txt.github/workflows/ci.yml.github/workflows/pr-review.yamlscripts/pr-review.py
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.
What this does
Adds the owner-triggered review workflow this repository was missing. A
/review deepcomment 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
scriptsto the lint and format paths, so the new file is checked rather than silently skipped.Required before it works
The
OPENAI_API_KEYrepository 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
Chores