feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml - #527
Conversation
…rivate — daily-pr-review-health.yml
|
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 36 minutes and 20 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ 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 (3)
📝 WalkthroughWalkthroughThis PR enhances ChangesClaude rate-limit error handling and test coverage
Sequence DiagramsequenceDiagram
participant Script as pr_review_health.sh
participant Claude as Claude CLI
participant Report as pr_review_health_report.md
participant Env as GITHUB_ENV
Script->>Claude: Invoke with logs
Claude-->>Report: Output (including rate-limit msg)
Script->>Report: Scan for rate-limit message
alt Rate-limit detected
Script->>Report: Write "Analysis deferred"
Script->>Env: Set HAS_FAILURES=false
Script->>Script: Exit 0 (success)
else No rate-limit
Script->>Script: Follow original error path
Script->>Script: Exit 1 or 0 per prior logic
end
🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 adds error-handling logic to scripts/pr_review_health.sh to identify transient Claude rate-limit and quota errors, preventing spurious workflow failures by deferring analysis and overriding the failure status. It also introduces a comprehensive unit test suite in tests/test_pr_review_health.bats using BATS. The review feedback suggests expanding the rate-limit regex pattern to cover more Claude-specific errors and prevent maintenance drift, and recommends refactoring the test suite to use a helper function for stubbing the Claude CLI to reduce code duplication.
There was a problem hiding this comment.
Pull request overview
Adjusts the PR Review Agent daily health check to treat Claude daily usage/rate-limit failures as a non-fatal, transient condition, preventing spurious workflow failures and issue creation while still surfacing an actionable warning/report.
Changes:
- Update
scripts/pr_review_health.shto detect Claude rate-limit/quota output, emit a::warning::, write a deferred-analysis report, and overrideHAS_FAILURES=falseto skip issue creation. - Add Bats tests covering Claude rate-limit handling vs non-rate-limit failures, plus the “no failures” early-exit path.
- Extend the
lint.ymlBats job to run the new health-check test suite.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
tests/test_pr_review_health.bats |
Adds unit/integration-style Bats coverage for Claude invocation failure modes and env/export behavior. |
scripts/pr_review_health.sh |
Adds rate-limit/quota detection to avoid failing the workflow and to suppress issue creation on transient Claude caps. |
.github/workflows/lint.yml |
Runs the new Bats test file in CI. |
Dev-Lead — fix-reviews (applied)Changes committed and pushed. |
Dev-Lead — waiting on PR blockers (intent: review-changes)PR: #527 |
|
Note @don-petry I reviewed this PR and no code changes were needed, but it still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews), so I cannot mark it done yet. I'll re-check automatically. |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/lint.yml (1)
36-48:⚠️ Potential issue | 🟠 Major | ⚡ Quick winCI integration is incomplete: the changed script is not ShellChecked.
This PR modifies
scripts/pr_review_health.sh, but theshellcheckstep still omits it, so the required shell lint gate does not cover this change.Suggested fix
- run: shellcheck --severity=warning scripts/fleet_monitor.sh scripts/fleet_report.sh scripts/token_report.sh scripts/lib/model-pricing.sh scripts/cut-release.sh + run: shellcheck --severity=warning \ + scripts/fleet_monitor.sh \ + scripts/fleet_report.sh \ + scripts/token_report.sh \ + scripts/lib/model-pricing.sh \ + scripts/cut-release.sh \ + scripts/pr_review_health.shAs per coding guidelines, "Lint all Bash scripts with ShellCheck using zero warnings severity" and "
scripts/**/*.sh: Lint all Bash scripts with ShellCheck using zero warnings."🤖 Prompt for 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. In @.github/workflows/lint.yml around lines 36 - 48, The CI currently does not ShellCheck the new scripts/pr_review_health.sh so add it to the shellcheck job in .github/workflows/lint.yml: update the ShellCheck step (e.g., the job named "Run ShellCheck" or whatever step runs shellcheck) to include scripts/pr_review_health.sh or, better, change its input pattern to scripts/**/*.sh so all scripts (including scripts/pr_review_health.sh) are linted with ShellCheck using the repo's zero-warnings configuration; then ensure the script fixes any ShellCheck warnings so the job passes.Source: Coding guidelines
🤖 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 `@scripts/pr_review_health.sh`:
- Line 234: Replace the single-bracket test used for the GITHUB_ENV guard with
the bash built-in double-bracket form: change the conditional that reads [ -n
"${GITHUB_ENV:-}" ] && echo "HAS_FAILURES=false" >> "$GITHUB_ENV" to use [[ -n
"${GITHUB_ENV:-}" ]] && echo "HAS_FAILURES=false" >> "$GITHUB_ENV" so the script
uses the safer bash conditional (preserving the existing quoting and redirect
behavior).
In `@tests/test_pr_review_health.bats`:
- Around line 109-118: The test "Claude rate limit: HAS_FAILURES is overridden
to false in GITHUB_ENV" only verifies presence of HAS_FAILURES=false; change it
to assert both HAS_FAILURES=true and HAS_FAILURES=false entries are written and
that the false entry comes after the true entry. After running the script (using
make_gh_stub_one_failure, make_claude_stub and running "$SCRIPT"), verify both
lines exist in "$GITHUB_ENV" and then compare their positions (e.g., via line
numbers) to ensure the HAS_FAILURES=false entry appears after HAS_FAILURES=true,
thereby enforcing the "last value wins" contract.
---
Outside diff comments:
In @.github/workflows/lint.yml:
- Around line 36-48: The CI currently does not ShellCheck the new
scripts/pr_review_health.sh so add it to the shellcheck job in
.github/workflows/lint.yml: update the ShellCheck step (e.g., the job named "Run
ShellCheck" or whatever step runs shellcheck) to include
scripts/pr_review_health.sh or, better, change its input pattern to
scripts/**/*.sh so all scripts (including scripts/pr_review_health.sh) are
linted with ShellCheck using the repo's zero-warnings configuration; then ensure
the script fixes any ShellCheck warnings so the job passes.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: f1485055-03b4-4c0a-8b87-008f95f9a8d9
📒 Files selected for processing (3)
.github/workflows/lint.ymlscripts/pr_review_health.shtests/test_pr_review_health.bats
Dev-Lead — fix-reviews (applied)Changes committed and pushed. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…rivate — daily-pr-review-health.yml (#527) * feat: implement issue #511 — [Fleet Monitor] petry-projects/.github-private — daily-pr-review-health.yml * fix(reviews): address review comments [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
Closes #511
Implemented by dev-lead agent. Please review.
Summary by CodeRabbit