feat(ci): skip labelling when the Rams quota is exhausted - #112
Conversation
Labelling at zero quota is worse than not labelling. Rams answers "limit reached", the label stays on the PR, and because re-adding an existing label fires no `labeled` webhook, that PR is never reviewed again — not even after the quota resets. The gate now checks first. The check calls the Rams MCP `usage` tool, which is free and consumes no review. A single POST works; no initialize handshake is needed. It skips only on a definite "0 left". An unset key, an unparseable response, or an unreachable API all fall through to labelling, because paid plans report no "N left" at all — failing closed there would stop labelling entirely on an upgrade. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
🚅 Deployed to the dub-rip-pr-112 environment in dub-rip
|
|
Warning Review limit reached
Next review available in: 42 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. 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 (1)
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 |
Squashed away at merge; deleted in the next commit. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Description
Follow-up to #111. The gate currently labels a qualifying PR regardless of whether Rams can actually review it — and that turns out to be the worst option available.
At zero quota, Rams answers "limit reached", the label stays on the PR, and because re-adding an existing label fires no
labeledwebhook, that PR is never reviewed again — not even once the quota resets. The label silently becomes a tombstone.So the gate now checks quota before labelling, via the Rams MCP
usagetool (free, consumes no review — a single POST, no initialize handshake needed).It skips only on a definite
0 left. Every other outcome falls through to labelling:RAMS_API_KEYsecret0 left18 leftThat asymmetry is deliberate. Failing closed on an unparseable response would silently stop labelling the moment the plan is upgraded, which is exactly the invisible breakage this PR is trying to prevent.
Future work
A skipped PR stays unlabelled until something re-triggers the workflow. Pushing again re-evaluates, and manual labelling always works, but a PR that is never touched again after a quota-exhausted run will sit unreviewed. A scheduled sweep over open PRs could close that gap if it proves annoying.
How to test
Requires a
RAMS_API_KEYrepository secret. Without it the check is skipped entirely and behaviour is identical to #111.All five decision branches were exercised against a mocked quota source, and the parser was verified against the live API plus synthetic plan strings:
0(live API, current state)18 leftPlan: team — unlimited reviewsactionlint(with shellcheck) passes clean.ramslabel to appearAuthor checklist
This PR:
🤖 Generated with Claude Code