feat: implement issue #711 — pr-review: rate-limited reviews are never auto-retried (no equivalent of dev-lead-retry) - #720
Conversation
…r auto-retried (no equivalent of dev-lead-retry)
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
More reviews will be available in 41 minutes and 41 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ 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 |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
There was a problem hiding this comment.
Code Review
This pull request introduces rate-limit detection and auto-retry handling for advisory/review bots that withhold reviews due to quota limits (issue #711). It adds logic to detect rate-limited bots, post a machine-detectable marker comment with a reset timestamp, and automatically re-dispatch reviews once the reset time has elapsed. The feedback highlights several critical improvements: replacing inside with any in jq to avoid unexpected substring matching of bot names, adding BSD date fallbacks to ensure macOS compatibility when parsing and calculating timestamps, and defensively filtering comments before using jq's capture function to prevent runtime errors on malformed markers.
Dev-Lead — fix-reviews (applied)Changes committed and pushed. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
|
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: MEDIUM
Reviewed commit: 56a68897cab66d1a4999ab7eef9bff4602916e84
Review mode: triage-approved (single reviewer)
Summary
Implements issue #711 (Option 1): makes pr-review-sweep rate-limit-aware so PRs withheld because advisory bots were out of quota auto-recover after the limit resets, instead of stranding at REVIEW_REQUIRED with green CI. Adds rate-limit detection + a machine-detectable marker in the advisory gate, and reorders the sweep to handle the rate-limited retry before the CI-green gate.
Linked issue analysis
Closes #711. All five acceptance criteria are met: (1) a withhold due to rate-limited advisory bots stamps a status=rate-limited marker (maybe_post_rate_limited_marker); (2) after the reset window the PR is re-dispatched via the normal trigger with no force_review (dispatch_review; tests assert force_review is never used, keeping the advisory gate armed); (3) unrelated cancelled/failed sibling checks no longer suppress the retry because the rate-limited branch runs before the CI-green gate (tests cover FAILING and CANCELLED siblings, AC3); (4) idempotency for non-rate-limited PRs is preserved (reviewed-at-head skip retained); (5) bats coverage added in both tests/test_sweep_stuck_reviews.bats and tests/dev-lead/unit/test_advisory_review_gate.bats.
Findings
No outstanding issues. All four prior gemini-code-assist review threads are resolved with fixes confirmed in the diff: inside replaced with any(. == $b) for exact bot-login matching (no substring false positives); GNU/BSD date fallbacks added in both review-one-pr.sh and sweep-stuck-reviews.sh for macOS; and a defensive and test("reset=[^ ]+") pre-filter before jq capture to avoid a runtime abort on malformed markers. Marker posting is deduplicated per head, the gate is sourced in an isolated subshell so its helpers/vars do not leak, and an unparseable reset fails open to a retry so a malformed marker cannot strand a PR. No auth/secrets/workflow-permission changes; changes are confined to shell orchestration logic plus tests.
CI status
All checks green. Required/security checks passing: CI (Lint, ShellCheck, Compile agentic workflows, Secret scan gitleaks, Agent Security Scan), CodeQL (actions + python), AgentShield, SonarCloud (Quality Gate passed, 0 new issues), bats, unit-tests, and Test Dev-Lead Agent suite. Remaining entries are SKIPPED (dependabot/dependency-audit ecosystems not applicable). No failing or cancelled gating checks.
Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.



Closes #711
Implemented by dev-lead agent. Please review.