Repository navigation
feat: implement issue #338 — [Fleet Monitor] petry-projects/.github-private — dev-lead.yml - #339
Conversation
…rivate — dev-lead.yml
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ 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 — human-pr (no-changes)No changes were needed for this PR. |
Dev-Lead — fix-bot-comment (no-changes)Engine ran but made no changes. |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: LOW
Reviewed commit: a7575c39d56dc30c81036c50853a982346fd3c14
Review mode: triage-approved (single reviewer)
Summary
This PR teaches dev-lead.yml to treat the engine's exit-code-2 ("all engines rate-limited") as a non-failure for the workflow, and adds matching rate-limit handling to scripts/dev-lead-fix-issue.sh so the issue intent now behaves like the already-converted fix-ci and fix-reviews intents. Two new bats tests cover the new branch. The change directly targets the cause of issue #338 (16.3% failure rate) — transient provider rate limits shouldn't count as workflow failures, since the retry cron already re-runs them.
Linked issue analysis
Issue #338 is a Fleet Monitor health alert flagging dev-lead.yml at 16.3% failure rate. The PR plausibly addresses the dominant failure mode (rate-limit exits from engine.sh) by:
- Wrapping each engine-running step so
rc=2→ workflow exit 0. - Adding parity rate-limit handling to
dev-lead-fix-issue.sh, which previously only hadexit 1for any engine failure (so even rate-limits would have been counted).
This won't address non-rate-limit causes (real engine errors, timeouts, transient infra), but it's the right scoped fix for the metric.
Findings
No blockers.
Minor (non-blocking) observations:
- The wrapper pattern
[ "$rc" -eq 2 ] && exit 0 || exit "$rc"is repeated across seven steps. It's correct underset -eo pipefail(verified) but a small helper or acasewould be slightly easier to read. Not worth fixing in this PR. dev-lead-fix-issue.shposts a rate-limited comment on the issue without the dedup check thatdev-lead-fix-ci.shuses for PRs (has_rate_limited_marker). Re-applying thedev-leadlabel while rate limits persist could post duplicate notices on the issue. Low-impact; can be tightened later if it becomes noisy.- The
rm -f "$prompt_file"cleanup is duplicated in both the rate-limited and error branches. A trap-based cleanup would be tidier but isn't required.
CI status
All required checks succeeded: CodeQL, SonarCloud (Quality Gate passed, 0 new issues), shellcheck, bats unit tests, AgentShield, gitleaks, Agent Security Scan, and lint. Merge state is BLOCKED only because review approval is required.
Reviewed automatically by the PR-review agent (single-reviewer mode: opus 4.7). Reply if you need a human review.
There was a problem hiding this comment.
Pull request overview
This PR addresses Issue #338’s elevated failure rate for the dev-lead.yml workflow by treating “all engines rate-limited” as a non-failing outcome and adding explicit handling for rate-limits in the issue-fixing script.
Changes:
- Update
dev-lead-fix-issue.shto distinguish rate-limit exhaustion (exit code2) from real engine failures (exit code1) and to post an issue comment when rate-limited. - Update
dev-lead.ymlsteps to treat exit code2as a successful workflow outcome for relevant intents (fix-ci/fix-reviews/issue/etc.). - Add Bats unit tests covering rate-limit behavior for
dev-lead-fix-issue.sh.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
tests/dev-lead/unit/test_fix_issue.bats |
Adds unit tests verifying exit code 2 and issue-comment posting on rate-limit exhaustion. |
scripts/dev-lead-fix-issue.sh |
Adds explicit handling for run_writer_with_fallback returning 2 (rate-limited) with an issue comment + exit 2. |
.github/workflows/dev-lead.yml |
Wraps intent scripts so exit 2 (rate-limited) does not fail the workflow run. |
Comments suppressed due to low confidence (1)
tests/dev-lead/unit/test_fix_issue.bats:229
- This gh stub returns
[]for the open-pulls query, but the script under test uses--jq ... | lengthand expects a numeric count (0). Returning0here would better match realgh api --jqoutput and avoid potentialinteger expression expectedmessages during the test run.
case "\$*" in
*"pulls?state=open"*) echo "[]" ;;
*"api"*"repos/"*"issues/"*) echo '{"title":"Test","body":"body"}' ;;
*"api"*"users/"*) echo '{"id":12345}' ;;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request implements explicit rate-limit handling in the dev-lead-fix-issue.sh script, ensuring that when all engines are rate-limited, a comment is posted to the GitHub issue and the script exits with code 2. Corresponding unit tests have been added to validate this logic. Feedback suggests improving the user experience by including the specific rate-limit reset time in the issue comment, utilizing existing mechanisms to extract this timestamp.
Dev-Lead — fix-reviews (applied)Changes committed and pushed. |
b44e019
Dev-Lead — human-pr (no-changes)No changes were needed for this PR. |
Dev-Lead — fix-bot-comment (no-changes)Engine ran but made no changes. |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: LOW
Reviewed commit: b44e01964bf5c0e97c02ce93442f1aae8eee30bb
Review mode: triage-approved (single reviewer)
Summary
Confirmation review of a triage-approved PR. The PR makes dev-lead.yml and scripts/dev-lead-fix-issue.sh treat engine exit-code-2 ("all engines rate-limited") as a non-failure, addressing the elevated failure rate flagged in issue #338. The new commit since the prior cascade review (b44e019) cleanly addresses two bot review comments without introducing new risk.
Linked issue analysis
Issue #338 is a Fleet Monitor health alert flagging dev-lead.yml at 16.3% failure rate. The PR plausibly addresses the dominant failure mode — transient rate-limit exits from engine.sh — by giving the issue intent the same exit-code-2 treatment that fix-ci and fix-reviews already have, and by wrapping the affected workflow steps so rc=2 exits the job as success. The retry cron picks them up later, so swallowing the rate-limit signal at the workflow level is the right scoped fix for this metric.
Findings
No blockers.
Incremental commit (b44e019) verified:
- Gemini's suggestion (reset time in issue comment): Now reads
/tmp/dev-lead-rate-limit-resetand appendsThe limit is expected to reset at <ts>.when present. Pattern matchesscripts/dev-lead-fix-ci.sh:154andscripts/dev-lead-fix-reviews.sh:263; the file is populated byparse_reset_timeinscripts/engine.sh:347-381. Defensive: empty-string and missing-file cases both fall back cleanly. - Copilot's suggestion (bats stub returns numeric, not JSON array): Two stubs in
tests/dev-lead/unit/test_fix_issue.batsnow echo"0"instead of"[]". This matches realgh api --jq '... | length'output and avoids theinteger expression expectedfailure mode the stub would have hit when feeding[]into[ "$existing" -gt 0 ].
No new concerns introduced. Prior cascade-review observations (repeated rc=2 wrapper, lack of dedup marker on the rate-limit issue comment, repeated rm -f cleanup) remain as low-impact polish items not worth blocking on.
CI status
All required checks succeeded: CodeQL, SonarCloud (Quality Gate passed, 0 new issues), shellcheck, bats, AgentShield, gitleaks, Agent Security Scan, lint, validate-agent-profiles, gh-aw-compile, Compile agentic workflows. mergeStateStatus is BLOCKED only because review approval is required.
Reviewed automatically by the PR-review agent (single-reviewer mode: opus 4.7). Reply if you need a human review.
Dev-Lead — human-pr (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: LOW
Reviewed commit: aad7043747810db9554e7647fd7296e4fd8b9217
Review mode: triage-approved (single reviewer)
Summary
Confirmation review of a triage-approved PR. There are no functional changes since the prior cascade approval at b44e019 — the current head (aad7043) is a merge of main that brings in a single unrelated commit (1363ec0, "ci: use CLAUDE_CODE_OAUTH_TOKEN secret in ci-failure-analyst"), which touches only .github/workflows/ci-failure-analyst.lock.yml. None of the PR's own files (dev-lead.yml, scripts/dev-lead-fix-issue.sh, tests/dev-lead/unit/test_fix_issue.bats) were modified by the merge.
Linked issue analysis
Issue #338 is a Fleet Monitor health alert flagging dev-lead.yml at a 16.3% failure rate. The PR addresses the dominant failure mode — transient rate-limit exits from engine.sh — by giving the issue intent the same exit-code-2 treatment that fix-ci and fix-reviews already have, and by wrapping the affected workflow steps so rc=2 exits the job as success. The retry cron picks them up later, so swallowing the rate-limit signal at the workflow level is the correct scoped fix for the metric. This analysis stands unchanged from the prior review.
Findings
No blockers.
Delta since the previous review (b44e019 → aad7043):
- Merge commit only.
git compareshows one upstream commit (1363ec0) modifying.github/workflows/ci-failure-analyst.lock.yml— no overlap with this PR's changed files and no behavioural impact on the rate-limit handling under review. - All previously-noted low-impact polish items (repeated
rc=2wrapper pattern, no dedup marker on the rate-limit issue comment, duplicatedrm -fcleanup) remain. Still not worth blocking on.
CI status
All required checks succeeded on the new head SHA: CodeQL, SonarCloud (Quality Gate passed, 0 new issues), shellcheck, bats, AgentShield, gitleaks, Agent Security Scan, lint, validate-agent-profiles, gh-aw-compile, Compile agentic workflows, PR Review Agent, Dev-Lead dispatch. reviewDecision is already APPROVED from the prior cycle; mergeStateStatus is UNKNOWN pending re-evaluation.
Reviewed automatically by the PR-review agent (single-reviewer mode: opus 4.7). Reply if you need a human review.
…rivate — dev-lead.yml (#339) * feat: implement issue #338 — [Fleet Monitor] petry-projects/.github-private — dev-lead.yml * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com> Co-authored-by: donpetry-bot <donpetry-bot@users.noreply.github.com>
…rivate — dev-lead.yml (#339) * feat: implement issue #338 — [Fleet Monitor] petry-projects/.github-private — dev-lead.yml * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com> Co-authored-by: donpetry-bot <donpetry-bot@users.noreply.github.com>
…rivate — dev-lead.yml (#339) * feat: implement issue #338 — [Fleet Monitor] petry-projects/.github-private — dev-lead.yml * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com> Co-authored-by: donpetry-bot <donpetry-bot@users.noreply.github.com>
…rivate — dev-lead.yml (#339) * feat: implement issue #338 — [Fleet Monitor] petry-projects/.github-private — dev-lead.yml * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com> Co-authored-by: donpetry-bot <donpetry-bot@users.noreply.github.com>
…rivate — dev-lead.yml (#339) * feat: implement issue #338 — [Fleet Monitor] petry-projects/.github-private — dev-lead.yml * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com> Co-authored-by: donpetry-bot <donpetry-bot@users.noreply.github.com>
…rivate — dev-lead.yml (#339) * feat: implement issue #338 — [Fleet Monitor] petry-projects/.github-private — dev-lead.yml * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com> Co-authored-by: donpetry-bot <donpetry-bot@users.noreply.github.com>
…rivate — dev-lead.yml (#339) * feat: implement issue #338 — [Fleet Monitor] petry-projects/.github-private — dev-lead.yml * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com> Co-authored-by: donpetry-bot <donpetry-bot@users.noreply.github.com>
…rivate — dev-lead.yml (#339) * feat: implement issue #338 — [Fleet Monitor] petry-projects/.github-private — dev-lead.yml * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com> Co-authored-by: donpetry-bot <donpetry-bot@users.noreply.github.com>



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