fix(impl-review): retry quality-score label on transient API failures#5725
Merged
Conversation
The "Add quality score label" step (impl-review.yml:256-265) had no retry on `gh pr edit --add-label`, so a single transient GitHub API 5xx left the PR stuck with no quality label. Subsequent verdict steps couldn't run, and the job-level auto-retry (line 511) only triggers on `steps.review.conclusion == 'failure'`, not on label-add failures — so the PR was permanently in limbo. Observed in daily-regen run 25392762766: highcharts review attempt 3 hit 504 Gateway Timeout on the label-add → workflow died → PR #5722 stuck open without ai-approved/ai-rejected. Same retry pattern as the verdict-label step a few lines below already uses (lines 289-300). Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the robustness of the impl-review.yml GitHub Actions workflow by adding a retry when applying the quality:<score> label to a PR, preventing transient GitHub API failures (e.g., 5xx/504) from leaving implementation PRs stuck without progress.
Changes:
- Add a retry block around
gh pr edit --add-label "quality:<score>"to handle transient API failures during labeling.
Comment on lines
263
to
+272
| LABEL="quality:${SCORE}" | ||
| gh label create "$LABEL" --color "0e8a16" --description "Quality score ${SCORE}/100" 2>/dev/null || true | ||
| gh pr edit "$PR_NUM" --add-label "$LABEL" | ||
| # Retry on transient GitHub API failures (e.g. 504) — without this, | ||
| # a single 5xx leaves the PR stuck with no quality label and the | ||
| # downstream verdict step is gated on this step's success. | ||
| gh pr edit "$PR_NUM" --add-label "$LABEL" 2>/dev/null || { | ||
| echo "::warning::Failed to add quality score label, retrying..." | ||
| sleep 2 | ||
| gh pr edit "$PR_NUM" --add-label "$LABEL" | ||
| } |
Owner
Author
There was a problem hiding this comment.
Addressed in commit e518188 — added a pre-add cleanup block that strips any existing quality:* labels other than the new one before adding it. Idempotent: a fresh PR has no stale labels and the remove is a no-op.
Per Copilot review on PR #5725: each review attempt added a `quality:N` label without removing prior `quality:M` labels, so repaired PRs accumulated multiple quality labels (e.g. PR #5722 carried both quality:73 and quality:81). Downstream readers relying on label ordering could pick the wrong one. Strip any existing `quality:*` labels other than the current score before adding the new one. Idempotent: a fresh PR has no stale labels and the remove call is a no-op via `|| true`. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The `Add quality score label` step in `impl-review.yml` (lines 256-265)
called `gh pr edit --add-label` once with no retry. A single transient
GitHub API 5xx left the PR stuck with no quality label, no verdict label,
and no path forward — because the job-level auto-retry (line 511) only
triggers on `steps.review.conclusion == 'failure'`, not on later step
failures.
Why
Observed in daily-regen run 25392762766:
highcharts PR #5722 review attempt 3 hit `504 Gateway Timeout` on the
label-add step → workflow died → PR is stuck open with quality:73,quality:81
labels but no `ai-approved`/`ai-rejected` verdict. Manual re-trigger needed.
The verdict-label step a few lines below already has the same retry pattern
(lines 289-300) — this just brings the quality-label step in line.
Changes
`|| { sleep 2; retry }` pattern the verdict step uses.
Test plan
retry kicks in and the PR proceeds to verdict labelling.
🤖 Generated with Claude Code