You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The daily-pr-review-health.yml health check fails when the Claude CLI hits its daily usage limit. From the failing run (2026-06-09T08:58:14Z):
##[error]Claude invocation failed. CLI output follows:
You've hit your limit Β· resets 4pm (UTC)
The script calls exit 1 unconditionally on any Claude failure, including transient rate limits that are not indicative of a real PR review agent health problem.
Scope
Add graceful rate-limit handling to scripts/pr_review_health.sh so that a transient Claude usage-cap does not mark the health-check workflow as failed. Emit a ::warning:: annotation instead and exit 0.
Implementation Checklist
scripts/pr_review_health.sh β detect rate limit in Claude error handler block; emit ::warning::, override HAS_FAILURES=false, exit 0
tests/test_pr_review_health.bats β new test file covering rate-limit exit-0, non-rate-limit exit-1, and no-failures skip-Claude paths
.github/workflows/lint.yml β add new test file to bats test list (per AGENTS.md exception rule)
Tests to Write
"Claude rate limit exits 0 and emits ::warning:: annotation" β stub claude to output "You've hit your limit", verify exit 0 and ::warning:: in output
"Non-rate-limit Claude failure exits 1 and emits ::error:: annotation" β stub claude to output generic error, verify exit 1 and ::error:: in output
"No failed runs exits 0 without invoking Claude" β stub gh to return all-success runs, verify exit 0 and no Claude invocation
Test Command
bats tests/test_pr_review_health.bats
Pattern Reference
The rate-limit grep pattern follows _rate_limit_pattern() in scripts/engine.sh (the codebase's single source of truth), specifically the hit your limit and resets [0-9]+(am|pm) tokens that match the observed error message.
The failing run (2026-06-09T08:58:14Z) hit the Claude daily usage limit:
You've hit your limit Β· resets 4pm (UTC)
scripts/pr_review_health.sh called exit 1 unconditionally on any Claude failure, so a transient rate-limit caused the health-check workflow to register as a hard failure β inflating the failure rate with noise unrelated to the PR review agent's health.
Plan Execution
scripts/pr_review_health.sh β added rate-limit detection after Claude failure; emits ::warning::, overrides HAS_FAILURES=false in $GITHUB_ENV, exits 0
.github/workflows/lint.yml β added tests/test_pr_review_health.bats to bats test list per AGENTS.md exception rule
Test Results
1..179
...
ok 175 Claude rate limit exits 0 and emits ::warning:: annotation
ok 176 Claude rate limit: HAS_FAILURES is overridden to false in GITHUB_ENV
ok 177 Claude 'usage limit' message also triggers rate-limit handling (exit 0)
ok 178 non-rate-limit Claude failure exits 1 and emits ::error:: annotation
ok 179 no failed runs in window exits 0 without invoking Claude
179 tests, 0 failures
Lint: shellcheck --severity=warning on all 40 scripts/**/*.sh β passed. Agent profile frontmatter β passed.
Files Changed
scripts/pr_review_health.sh: 13-line addition in the Claude error handler β detect rate-limit keywords via grep -qiE (pattern mirrors _rate_limit_pattern() in engine.sh), emit ::warning::, override HAS_FAILURES=false, exit 0
tests/test_pr_review_health.bats: new test file, 5 tests covering all error-handling paths
.github/workflows/lint.yml: added new test file to bats run list
Notes
The HAS_FAILURES=false override prevents the issue-creation step from filing a spurious ticket; a ::warning:: annotation in the Actions log preserves visibility for operators
Non-rate-limit Claude errors (e.g. segfault, configuration error) still exit 1 as before β only genuine rate-limit/quota messages are handled gracefully
Pattern breadth: quota alone is intentionally conservative; combined with the Claude-specific context (only fires after if ! claude ...) false-positive risk is negligible
Activity
don-petry commentedon Jun 9, 2026
Dev-Lead Implementation Plan
Issue: #511 β [Fleet Monitor] petry-projects/.github-private β daily-pr-review-health.yml
Root Cause
The
daily-pr-review-health.ymlhealth check fails when the Claude CLI hits its daily usage limit. From the failing run (2026-06-09T08:58:14Z):The script calls
exit 1unconditionally on any Claude failure, including transient rate limits that are not indicative of a real PR review agent health problem.Scope
Add graceful rate-limit handling to
scripts/pr_review_health.shso that a transient Claude usage-cap does not mark the health-check workflow as failed. Emit a::warning::annotation instead and exit 0.Implementation Checklist
scripts/pr_review_health.shβ detect rate limit in Claude error handler block; emit::warning::, overrideHAS_FAILURES=false, exit 0tests/test_pr_review_health.batsβ new test file covering rate-limit exit-0, non-rate-limit exit-1, and no-failures skip-Claude paths.github/workflows/lint.ymlβ add new test file to bats test list (per AGENTS.md exception rule)Tests to Write
"Claude rate limit exits 0 and emits ::warning:: annotation"β stubclaudeto output "You've hit your limit", verify exit 0 and::warning::in output"Non-rate-limit Claude failure exits 1 and emits ::error:: annotation"β stubclaudeto output generic error, verify exit 1 and::error::in output"No failed runs exits 0 without invoking Claude"β stubghto return all-success runs, verify exit 0 and no Claude invocationTest Command
bats tests/test_pr_review_health.batsPattern Reference
The rate-limit grep pattern follows
_rate_limit_pattern()inscripts/engine.sh(the codebase's single source of truth), specifically thehit your limitandresets [0-9]+(am|pm)tokens that match the observed error message.don-petry commentedon Jun 9, 2026
Dev-Lead: Implementation Complete
Root Cause
The failing run (2026-06-09T08:58:14Z) hit the Claude daily usage limit:
scripts/pr_review_health.shcalledexit 1unconditionally on any Claude failure, so a transient rate-limit caused the health-check workflow to register as a hard failure β inflating the failure rate with noise unrelated to the PR review agent's health.Plan Execution
scripts/pr_review_health.shβ added rate-limit detection after Claude failure; emits::warning::, overridesHAS_FAILURES=falsein$GITHUB_ENV, exits 0tests/test_pr_review_health.batsβ 5 new tests (3 rate-limit paths, 1 non-rate-limit error, 1 no-failures skip).github/workflows/lint.ymlβ addedtests/test_pr_review_health.batsto bats test list per AGENTS.md exception ruleTest Results
Lint:
shellcheck --severity=warningon all 40scripts/**/*.shβ passed. Agent profile frontmatter β passed.Files Changed
scripts/pr_review_health.sh: 13-line addition in the Claude error handler β detect rate-limit keywords viagrep -qiE(pattern mirrors_rate_limit_pattern()inengine.sh), emit::warning::, overrideHAS_FAILURES=false, exit 0tests/test_pr_review_health.bats: new test file, 5 tests covering all error-handling paths.github/workflows/lint.yml: added new test file to bats run listNotes
HAS_FAILURES=falseoverride prevents the issue-creation step from filing a spurious ticket; a::warning::annotation in the Actions log preserves visibility for operatorsquotaalone is intentionally conservative; combined with the Claude-specific context (only fires afterif ! claude ...) false-positive risk is negligiblefeat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
15 remaining items
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦
feat: implement issue #511 β [Fleet Monitor] petry-projects/.github-pβ¦