Skip to content

fix(impl-review): retry quality-score label on transient API failures#5725

Merged
MarkusNeusinger merged 2 commits into
mainfrom
fix/impl-review-label-retry
May 5, 2026
Merged

fix(impl-review): retry quality-score label on transient API failures#5725
MarkusNeusinger merged 2 commits into
mainfrom
fix/impl-review-label-retry

Conversation

@MarkusNeusinger
Copy link
Copy Markdown
Owner

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

  • `impl-review.yml:262-269`: wrap `gh pr edit --add-label` in the same
    `|| { sleep 2; retry }` pattern the verdict step uses.

Test plan

  • On next transient 5xx during a quality-score label add, verify the
    retry kicks in and the PR proceeds to verdict labelling.
  • No regression on the happy path (idempotent label-add).

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings May 5, 2026 18:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
}
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@MarkusNeusinger MarkusNeusinger merged commit be230e2 into main May 5, 2026
9 checks passed
@MarkusNeusinger MarkusNeusinger deleted the fix/impl-review-label-retry branch May 5, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants