fix(dev-lead): add concurrency queue to prevent batch API quota exhaustion#376
Conversation
…stion All dev-lead workflow failures in the monitored window (45.8% failure rate) were caused by Fleet Monitor batch-labeling multiple issues simultaneously, triggering concurrent runs that exhausted Claude and GitHub API quotas. Serialising all runs with a global concurrency group prevents this without dropping any work. Also fixes pre-existing SC2043 shellcheck warnings in scripts/ that caused dev-lead-lint.sh to exit non-zero. Closes #315 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughAdds a ChangesWorkflow Concurrency and Script Preflight Fixes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 simplifies the preflight checks in scripts/apply-repo-settings.sh and scripts/setup-code-quality-ruleset.sh by replacing the single-item loop for gh with a direct command check. The review feedback suggests improving error handling by redirecting the error messages to standard error (stderr) instead of standard output (stdout) in both scripts.
There was a problem hiding this comment.
Pull request overview
This PR reduces dev-lead workflow failures caused by multiple concurrent runs exhausting shared external API quotas, by introducing a global concurrency queue for the workflow and cleaning up related lint warnings in supporting scripts.
Changes:
- Add workflow-level
concurrencyto.github/workflows/dev-lead.ymlto queue alldev-leadruns (no cancellation). - Fix SC2043 ShellCheck warnings by removing single-item
forloops in two repo admin scripts. - Keep existing permissions and reusable-workflow wiring intact.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
.github/workflows/dev-lead.yml |
Queues dev-lead workflow runs to prevent concurrent executions from exhausting shared API quotas. |
scripts/apply-repo-settings.sh |
Removes a single-item for loop in preflight to satisfy ShellCheck (SC2043). |
scripts/setup-code-quality-ruleset.sh |
Removes a single-item for loop in preflight to satisfy ShellCheck (SC2043). |
CI Failure: SonarCloud Code AnalysisStep: SonarCloud Quality Gate SonarCloud scanned the changes in this PR and the quality gate did not pass. The diff modifies two shell scripts ( Suggested fix: Open the SonarCloud dashboard for this PR (linked from the check details), review the "New Issues" tab to see the exact rules violated in the changed lines, and address each flagged finding in |
Dev-Lead — fix-reviews (applied)Changes committed and pushed. |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
|
Auto-rebase blocked — the base branch contains Please rebase this branch manually: |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: LOW
Reviewed commit: 13b17c3c5715c29c9cc062441852ec69b40c2c67
Review mode: triage-approved (single reviewer)
Summary
Serializes dev-lead workflow runs via a global concurrency group to stop concurrent batch-label runs from exhausting shared API quotas (issue #315), plus two SC2043 shellcheck lint fixes. Small, config/lint-only, CI green.
Linked issue analysis
Closes #315. The root cause — concurrent dev-lead runs racing for GitHub/Claude/Gemini API quota — is directly addressed by 'concurrency: { group: dev-lead, cancel-in-progress: false }', which queues all runs globally without dropping work. This is the correct mechanism for the failure mode documented in the PR body.
Findings
- .github/workflows/dev-lead.yml: adds a static concurrency group; permissions: {} preserved, reusable-workflow wiring unchanged. No security smell, no injection vector. Sound fix.
- scripts/apply-repo-settings.sh / setup-code-quality-ruleset.sh: replace single-item 'for' loop with a direct 'command -v gh' check (fixes SC2043) and redirect the missing-gh error to stderr. Behavior-preserving.
- Nit (non-blocking): the adjacent 'gh auth status' error echo still writes to stdout, so the gemini stderr suggestion is only partially applied. Cosmetic, out of this fix's scope.
CI status
All green on 13b17c3: CodeQL (actions/javascript-typescript/python) SUCCESS, CodeRabbit SUCCESS, SonarCloud Quality Gate passed (0 new issues). Note: mergeStateStatus is BEHIND (branch needs a rebase before merge) — a merge-readiness item, not a review blocker.
Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.
|
CI Failure: SonarCloud Code AnalysisStep: SonarCloud Quality Gate SonarCloud is an external quality gate that analyzes code against configured rules and thresholds. The check failed on the Suggested fix: Review the SonarCloud dashboard at https://sonarcloud.io/dashboard?id=petry-projects_google-app-scripts&branch=main to identify the specific failing condition (coverage drop, new bug/smell/hotspot), then address the flagged issue in the PR branch before re-running the check. |



Closes #315
Root Cause
All dev-lead failures in the monitored window (45.8%, 11/24 runs) were caused by Fleet Monitor batch-labeling multiple issues simultaneously, triggering concurrent runs that exhausted shared API quotas:
gh apicall ended up as the value of a bash integer variable, causing a comparison failure.openai/o4-minifallback was also unavailable.The
statuses: readfix (PR #370) was already merged and did not prevent these failures.Fix
dev-lead.yml: Addconcurrency: { group: dev-lead, cancel-in-progress: false }. All dev-lead runs queue globally rather than running in parallel. Concurrent batch-label events now run sequentially and succeed rather than racing for API quota and failing.scripts/apply-repo-settings.shandscripts/setup-code-quality-ruleset.sh: Fix pre-existing SC2043 shellcheck warnings (single-itemforloop → directcommand -vcheck) sodev-lead-lint.shpasses.Test Results
bash .dev-lead/scripts/dev-lead-lint.sh: all checks passednpm run check: 0 errors (22 pre-existing warnings, unchanged)npm test: 301/301 passed🤖 Generated with Claude Code
Summary by CodeRabbit