diff --git a/.github/workflows/claude-issue-agent-run.yml b/.github/workflows/claude-issue-agent-run.yml index 4f421237c..167825833 100644 --- a/.github/workflows/claude-issue-agent-run.yml +++ b/.github/workflows/claude-issue-agent-run.yml @@ -65,7 +65,7 @@ jobs: actions: read # analyze mode gets read + comment + api tools only; triage/fix # additionally get Edit/Write + git/PR tools to actually make and push a - # fix (fix mode also gets gh api to resolve its invoking comment). Task + # fix (analyze/fix need gh api to read their invoking comment). Task # is blocked in all modes so the agent can't offload work to a # background sub-agent and exit before it returns. All modes get read-only # git log and gh pr view/diff to trace a regression to its pull request. @@ -176,17 +176,24 @@ jobs: cannot determine the correct change with confidence, do NOT open a PR — explain why in your step 2 comment instead. - If MODE is "analyze", do NOT label, edit, or open PRs. Instead, ONLY after - you posted a CONCLUSIVE answer in step 2 (not a request for more info), - resolve the invoking comment by minimizing it as resolved: - gh api graphql -f query='mutation($id:ID!){minimizeComment(input:{classifier:RESOLVED,subjectId:$id}){minimizedComment{isMinimized}}}' -f id='${{ inputs.comment_node_id }}' - If you instead asked for more information, do NOT minimize it. + If MODE is "analyze", do NOT label, edit, or open PRs. - If MODE is "fix", do NOT label or edit issue metadata. Instead, ONLY - after you successfully opened a fix PR in step 5, resolve the invoking - comment the same way: - gh api graphql -f query='mutation($id:ID!){minimizeComment(input:{classifier:RESOLVED,subjectId:$id}){minimizedComment{isMinimized}}}' -f id='${{ inputs.comment_node_id }}' - If you did not open a PR, do NOT minimize it. + If MODE is "fix", do NOT label or edit issue metadata. + + Do not minimize or otherwise touch the invoking comment, the workflow + resolves it once you are done. Follow the repository's AGENTS.md conventions for commit/PR style. Do not force-push and do not touch unrelated files. + + # the agent posts its result as a comment, so the command has been answered + # whatever that result was. only a failed run leaves it open, there is no + # answer then + - name: Resolve invoking comment + if: inputs.comment_node_id != '' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_ID: ${{ inputs.comment_node_id }} + run: | + gh api graphql -f id="$NODE_ID" -f query=' + mutation($id:ID!){minimizeComment(input:{subjectId:$id,classifier:RESOLVED}){minimizedComment{isMinimized}}}' diff --git a/.github/workflows/command-analyze.yml b/.github/workflows/command-analyze.yml index 51a09aad0..70f353244 100644 --- a/.github/workflows/command-analyze.yml +++ b/.github/workflows/command-analyze.yml @@ -6,8 +6,8 @@ on: # Triggered by a `/analyze` comment on any issue or PR conversation. Delegates to # the shared issue agent in analyze mode, which investigates, posts one answer -# comment, then minimizes the calling `/analyze` comment as RESOLVED — but only -# when it actually answered. +# comment, then minimizes the calling `/analyze` comment as RESOLVED, whatever +# the answer says. jobs: analyze: name: Analyze on demand diff --git a/.github/workflows/command-backport.yml b/.github/workflows/command-backport.yml index 5a5ed8882..3c6d8139f 100644 --- a/.github/workflows/command-backport.yml +++ b/.github/workflows/command-backport.yml @@ -198,11 +198,12 @@ jobs: }); - name: Resolve command comment - if: steps.create.outputs.url + if: always() uses: actions/github-script@v8 with: script: | - // collapse the /backport comment as resolved now that the pull request exists + // collapse the /backport comment as resolved, the result was reported + // back as a comment either way await github.graphql( `mutation($id:ID!){minimizeComment(input:{subjectId:$id,classifier:RESOLVED}){minimizedComment{isMinimized}}}`, { id: context.payload.comment.node_id } diff --git a/.github/workflows/command-fix.yml b/.github/workflows/command-fix.yml index 23035ba19..a8e4dd3f5 100644 --- a/.github/workflows/command-fix.yml +++ b/.github/workflows/command-fix.yml @@ -7,7 +7,7 @@ on: # Triggered by a `/fix` comment on any issue or PR conversation, maintainers only. # Delegates to the shared issue agent in fix mode, which investigates, pushes a # fix branch, opens a PR, comments with the result, then minimizes the calling -# `/fix` comment as RESOLVED — but only when it actually opened a PR. +# `/fix` comment as RESOLVED, whether or not a PR was opened. jobs: fix: name: Fix on demand