feat(pr-bot): coderabbit as required merge gate + auto-close (3-strike / 2-day stale)#508
Conversation
make coderabbit a hard merge gate instead of advisory. the new coderabbit-gate workflow reads coderabbit's review verdict via the api and publishes a `coderabbit-approved` commit status, which the branch ruleset now requires — so a labeled non-core pr only auto-merges once coderabbit approves, on top of ci + trust-gate + codeowners. the verdict is scoped to the pr head commit (via each review's commit_id), so a fresh push drops back to pending and cannot ride a stale approval through the gate. a pr coderabbit requests changes on 3 distinct commits without an approval is auto-closed with an explaining comment; the owner and bots are exempt so they can keep iterating. the decision logic (coderabbit_verdict / gate_status / should_close) lives in pr_bot.py as pure stdlib and is covered by tests. the workflow reads only review metadata and checks out the trusted base ref — no untrusted head code runs. org admins keep the ruleset bypass to override the gate when needed.
|
Warning Review limit reached
Next review available in: 2 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: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
✨ 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 |
makes CodeRabbit a hard merge gate instead of advisory, and auto-closes
PRs it keeps rejecting or that go stale. builds on #507 (which swapped
claude for coderabbit).
what changes
coderabbit-gateworkflow reads coderabbit's review verdict via the api and publishes a
coderabbit-approvedcommit status.setup_repo_guards.shadds thatstatus to the branch ruleset's required checks, so a labeled non-core pr
only auto-merges once coderabbit approves — on top of ci + trust-gate +
codeowners. org admins keep the ruleset bypass to override when needed.
the pr head commit via each review's
commit_id; a new commit with nocoderabbit review yet reports
pending, which holds the merge.distinct commits without an approval is auto-closed with an explaining,
reopenable comment.
stale-pr-reapercloses a prwhose author left a coderabbit change request unaddressed (no new commit)
for 2 days. strikes catches "keeps failing"; the reaper catches
"abandoned." the owner and bots are exempt from both.
how it's kept safe
the decision logic (
coderabbit_verdict/gate_status/should_close/
should_close_stale) lives inpr_bot.pyas pure stdlib and is coveredby tests. both workflows read only review metadata and check out a trusted
ref — no untrusted head code runs; every event field is passed through
env, not interpolated into a run block.
owner follow-up
test, re-runbash scripts/setup_repo_guards.sh test(and the same for
main) so the ruleset actually requires the newcoderabbit-approvedcheck.stale-pr-reaperis aschedule:workflow, which github only runsfrom the default branch — so it starts firing once this reaches
main, not ontest. (the gate itself runs ontestviapull_request_target.)