-
由 Will Chen 提交于
## Summary Enhanced the PR review responder workflow to support multiple retry iterations (up to 3) for Claude Code review requests. The workflow now tracks retry attempts using numbered labels (`cc:request:N`) and automatically re-requests reviews when new commits are pushed, while escalating to human review after max retries are exhausted. ## Key Changes - **Retry tracking**: Replaced simple `cc:request` label detection with support for `cc:request` (initial) and `cc:request:N` (re-request iterations) labels - **Max retry guard**: Added logic to prevent infinite loops by capping retries at 3 attempts; PRs reaching this limit are labeled with `cc:needs-human-review` for manual intervention - **Dynamic label management**: Updated label removal/addition to use the current label dynamically instead of hardcoding `cc:request` - **Conditional re-triggering**: Split the final label update into two paths: - If commits were pushed: increment the request count and apply `cc:request:N` to auto-re-request review - If no commits were pushed: apply `cc:done` label to mark completion - **Output tracking**: Added `commits_pushed` output to the retrigger step to enable conditional downstream steps - **Label creation**: Ensured next iteration labels are created before being applied to PRs ## Implementation Details - Request count is parsed from label names using regex matching (`/^cc:request:(\d+)$/`) - The workflow maintains state through GitHub labels, allowing it to resume correctly even if interrupted - Label creation attempts are wrapped in try-catch to gracefully handle existing labels - The retry loop is bounded at 3 iterations to prevent runaway automation https://claude.ai/code/session_01KNj2M6wfeQKjTPmkgGP5dt <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2493"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end --> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes a privileged GitHub Actions workflow’s control flow and label automation, which could cause unexpected re-trigger loops or incorrect PR state if misconfigured. Risk is bounded by the new max-retry guard and explicit `commits_pushed` gating. > > **Overview** > Adds **bounded auto-retry support** to `pr-review-responder.yml` by recognizing `cc:request` *and* numbered `cc:request:N` labels, tracking the current iteration via step outputs. > > When Claude pushes new commits, the workflow now emits a `commits_pushed` output, creates the next `cc:request:N` label if needed, and swaps `cc:pending` to the incremented request label to auto re-request review; if no commits were pushed it continues to mark the PR `cc:done`. > > Introduces a **max retry guard (>=3)** that removes the current request label and escalates the PR to `cc:needs-human-review` (creating the label if missing) to prevent infinite automation loops. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit d68ddd159d6160b221c03e862dedf5f2585c6573. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds an automatic re-request loop to the PR review responder so Claude reviews are re-requested on new commits. Iterations are tracked with cc:request:N labels (max 3), escalating to cc:needs-human-review at the limit or cc:done if no new commits. - **New Features** - Detect and parse cc:request / cc:request:N; pick highest count; expose request_count and current_label outputs. - Use dynamic label management: remove current_label, add cc:pending while processing. - On new commits: create next cc:request:N, apply it, retrigger via workflow_dispatch; set commits_pushed output. - On no commits: remove cc:pending and add cc:done. - After 3 retries: remove current_label and cc:pending, add cc:needs-human-review. <sup>Written for commit 1beb4f648e64628aaa8f59c5b0e1d6b315604212. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --------- Co-authored-by:
Claude <noreply@anthropic.com>