Skip to content

feat(ci): skip labelling when the Rams quota is exhausted - #112

Merged
jzstern merged 3 commits into
mainfrom
feat/rams-quota-check
Aug 4, 2026
Merged

feat(ci): skip labelling when the Rams quota is exhausted#112
jzstern merged 3 commits into
mainfrom
feat/rams-quota-check

Conversation

@jzstern

@jzstern jzstern commented Aug 4, 2026

Copy link
Copy Markdown
Owner

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 labeled webhook, 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 usage tool (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:

Situation Behaviour Why
No RAMS_API_KEY secret label check is opt-in; unchanged from #111
0 left skip the case this PR exists for
18 left label quota available
Paid/unlimited plan label those report no "N left" string at all
Rams API unreachable label transient; next push re-evaluates

That 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_KEY repository 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:

Case Expected Result
no secret configured label label
quota 0 (live API, current state) skip skip
quota 18 left label label
Plan: team — unlimited reviews label label
API unreachable label label

actionlint (with shellcheck) passes clean.

  • With the secret set and quota at 0, open a UI PR — expect no label, and a run summary saying quota is exhausted
  • After the quota resets (~Aug 7), push to that PR — expect the rams label to appear

Author checklist

This PR:

  • Satisfies a goal that is specific & clearly motivated
  • Adds value in isolation (whether user-facing or sustainability-related)
  • Contains a concise & easy-to-understand title + description
  • Adheres to SRP by default
  • Presents the best possible implementation to meet its goal, given constraints at hand

🤖 Generated with Claude Code

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>
@railway-app

railway-app Bot commented Aug 4, 2026

Copy link
Copy Markdown

🚅 Deployed to the dub-rip-pr-112 environment in dub-rip

Service Status Web Updated (UTC)
dub-rip ✅ Success (View Logs) Web Aug 4, 2026 at 4:13 am

@railway-app
railway-app Bot temporarily deployed to dub-rip / dub-rip-pr-112 August 4, 2026 04:10 Destroyed
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

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 @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: 7814f1da-af37-49ee-bb06-936db81b565c

📥 Commits

Reviewing files that changed from the base of the PR and between 70aba4f and 76c4835.

📒 Files selected for processing (1)
  • .github/workflows/rams-ui-gate.yml

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.

Squashed away at merge; deleted in the next commit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@railway-app
railway-app Bot temporarily deployed to dub-rip / dub-rip-pr-112 August 4, 2026 04:11 Destroyed
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@railway-app
railway-app Bot temporarily deployed to dub-rip / dub-rip-pr-112 August 4, 2026 04:12 Destroyed
@jzstern
jzstern merged commit 4658719 into main Aug 4, 2026
7 checks passed
@jzstern
jzstern deleted the feat/rams-quota-check branch August 4, 2026 04:14
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