• Will Chen's avatar
    Add retry loop support to PR review responder workflow (#2493) · 9587e79f
    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: 's avatarClaude <noreply@anthropic.com>
    9587e79f
名称
最后提交
最后更新
.claude 正在载入提交数据...
.cursor/rules 正在载入提交数据...
.devcontainer 正在载入提交数据...
.github 正在载入提交数据...
.husky 正在载入提交数据...
.storybook 正在载入提交数据...
assets 正在载入提交数据...
docs 正在载入提交数据...
drizzle 正在载入提交数据...
e2e-tests 正在载入提交数据...
makers 正在载入提交数据...
packages/@dyad-sh 正在载入提交数据...
scaffold 正在载入提交数据...
scripts 正在载入提交数据...
shared 正在载入提交数据...
src 正在载入提交数据...
testing 正在载入提交数据...
tools 正在载入提交数据...
worker 正在载入提交数据...
workers/tsc 正在载入提交数据...
.cursorignore 正在载入提交数据...
.env.example 正在载入提交数据...
.eslintrc.json 正在载入提交数据...
.gitattributes 正在载入提交数据...
.gitignore 正在载入提交数据...
.oxfmtrc.json 正在载入提交数据...
.oxlintrc.json 正在载入提交数据...
.prettierignore 正在载入提交数据...
.prettierrc 正在载入提交数据...
AGENTS.md 正在载入提交数据...
CLA.md 正在载入提交数据...
CLAUDE.md 正在载入提交数据...
CONTRIBUTING.md 正在载入提交数据...
LICENSE 正在载入提交数据...
README.md 正在载入提交数据...
SECURITY.md 正在载入提交数据...
biome.json 正在载入提交数据...
components.json 正在载入提交数据...
drizzle.config.ts 正在载入提交数据...
forge.config.ts 正在载入提交数据...
forge.env.d.ts 正在载入提交数据...
index.html 正在载入提交数据...
lint-staged.config.js 正在载入提交数据...
merge.config.ts 正在载入提交数据...
package-lock.json 正在载入提交数据...
package.json 正在载入提交数据...
playwright.config.ts 正在载入提交数据...
tsconfig.app.json 正在载入提交数据...
tsconfig.json 正在载入提交数据...
tsconfig.node.json 正在载入提交数据...
vite.main.config.mts 正在载入提交数据...
vite.preload.config.mts 正在载入提交数据...
vite.renderer.config.mts 正在载入提交数据...
vite.worker.config.mts 正在载入提交数据...
vitest.config.ts 正在载入提交数据...
windowsSign.ts 正在载入提交数据...