From 632ff159056ae513cbd1464318c97ecf9f2dd870 Mon Sep 17 00:00:00 2001 From: Phil Leggetter Date: Mon, 16 Mar 2026 23:16:10 +0000 Subject: [PATCH] fix(issue-auto-implement): comment on PR and skip Create PR when trigger is issue_comment on PR - Comment on PR (review iteration): run when issue_comment on PR (issue.pull_request) - Use PR_NUMBER from pull_request.number or issue.number for comment target - Create PR: skip when issue_comment on PR so we do not open a second PR - AGENTS.md: document that PR conversation comments trigger same iteration flow Made-with: Cursor --- .github/actions/issue-auto-implement/AGENTS.md | 8 ++++---- .github/actions/issue-auto-implement/action.yml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/actions/issue-auto-implement/AGENTS.md b/.github/actions/issue-auto-implement/AGENTS.md index 5e16475..e5bfdcd 100644 --- a/.github/actions/issue-auto-implement/AGENTS.md +++ b/.github/actions/issue-auto-implement/AGENTS.md @@ -14,10 +14,10 @@ For agents making changes to this action. This file summarizes flows, design dec - **Trigger:** `issue_comment.created` on an issue that **already has an open PR** for that issue. - **Flow:** Post a short reply on the issue directing the user to the PR; exit. No assessment or implement. -### 3. PR review → iteration +### 3. PR review or PR conversation comment → iteration -- **Triggers:** `pull_request_review.submitted`, `pull_request_review_comment.created` when the PR is from an automation branch or body contains "Closes #N". -- **Flow:** Resolve issue number from PR (body "Closes #N"/"Fixes #N" or head branch `auto-implement-issue-`) → assess with issue + review content → implement ("address review feedback"), push to same branch → verify → on pass: do **not** create PR; post comment on the PR summarizing the new commit(s). +- **Triggers:** `pull_request_review.submitted`, `pull_request_review_comment.created`, or `issue_comment.created` **on a PR** (when `issue.pull_request` is set) when the PR is from an automation branch or body contains "Closes #N". +- **Flow:** Resolve issue number from PR (body "Closes #N"/"Fixes #N" or head branch `auto-implement-issue-`) → assess with issue + review/comment content → implement ("address review feedback"), push to same branch → verify → on pass: do **not** create PR; post comment on the PR summarizing the new commit(s). ## Event normalization @@ -41,7 +41,7 @@ From the workflow event payload, derive: ## Implement–verify loop -- **Single step** `implement_verify_loop`: for each attempt from 1 to `max_implement_retries`, run implement (with `PREVIOUS_VERIFY_OUTPUT` from the previous failure, if any), commit and push, then run `verify_commands`. If verify passes, exit success. If it fails, set the verify output as `PREVIOUS_VERIFY_OUTPUT` and retry. After all attempts, fail. When this step succeeds: if trigger was `pull_request_review` or `pull_request_review_comment`, post a comment on the existing PR (no new PR); otherwise create PR. +- **Single step** `implement_verify_loop`: for each attempt from 1 to `max_implement_retries`, run implement (with `PREVIOUS_VERIFY_OUTPUT` from the previous failure, if any), commit and push, then run `verify_commands`. If verify passes, exit success. If it fails, set the verify output as `PREVIOUS_VERIFY_OUTPUT` and retry. After all attempts, fail. When this step succeeds: if trigger was `pull_request_review`, `pull_request_review_comment`, or `issue_comment` on a PR (`issue.pull_request` set), post a comment on the existing PR (no new PR); otherwise create PR. ## Branch and PR diff --git a/.github/actions/issue-auto-implement/action.yml b/.github/actions/issue-auto-implement/action.yml index ff4866e..2e05b9e 100644 --- a/.github/actions/issue-auto-implement/action.yml +++ b/.github/actions/issue-auto-implement/action.yml @@ -266,12 +266,12 @@ runs: -d "$(jq -n --arg b "$BODY" '{body: $b}')" echo "Posted comment on issue #$ISSUE_NUMBER (verify exhausted)" - name: Comment on PR (review iteration) - if: steps.assess.outputs.action == 'implement' && steps.implement_verify_loop.outcome == 'success' && (github.event_name == 'pull_request_review' || github.event_name == 'pull_request_review_comment') + if: steps.assess.outputs.action == 'implement' && steps.implement_verify_loop.outcome == 'success' && (github.event_name == 'pull_request_review' || github.event_name == 'pull_request_review_comment' || (github.event_name == 'issue_comment' && github.event.issue.pull_request)) shell: bash env: GITHUB_TOKEN: ${{ inputs.github_token }} REPO: ${{ github.repository }} - PR_NUMBER: ${{ github.event.pull_request.number }} + PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }} run: | BODY="Addressed review feedback. New commit(s) pushed; verification passed." curl -s -X POST \ @@ -281,7 +281,7 @@ runs: -d "$(jq -n --arg b "$BODY" '{body: $b}')" echo "Posted comment on PR #$PR_NUMBER" - name: Create PR - if: steps.assess.outputs.action == 'implement' && steps.implement_verify_loop.outcome == 'success' && github.event_name != 'pull_request_review' && github.event_name != 'pull_request_review_comment' + if: steps.assess.outputs.action == 'implement' && steps.implement_verify_loop.outcome == 'success' && github.event_name != 'pull_request_review' && github.event_name != 'pull_request_review_comment' && !(github.event_name == 'issue_comment' && github.event.issue.pull_request) shell: bash env: GITHUB_TOKEN: ${{ inputs.github_token }}