ci: let PR comments trigger a Claude review reconcile round - #361
Conversation
The pr-review job now also runs on issue_comment events on PRs, so answering an open review question or finding in a PR comment triggers Claude to reconcile the outstanding threads. This is opt-in per the shared action's issue_comment support. Comments from any human or bot are allowed; only the reviewer itself (mega-maxwell[bot]) is skipped to avoid self-triggering loops. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GCc8MLBBAp5jAxc2x19swa
Claude review status
🛠️ Review did not finish Attempted head This round did not publish: MODEL_ACTION_FAILED in phase review_retry. Anything listed below is from the last round that did. Re-run the workflow or push a new commit to try again. |
🧬 Mutation testing — ✅ PASSNothing to test — no mutants were generated on the changed lines. |
🧬 Mutation testingNo results at |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ed1be6ce8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || '' }} |
There was a problem hiding this comment.
Avoid privileged checkout of untrusted fork heads
For a fork PR, an issue_comment workflow runs in the base repository context, so this job can access CLAUDE_CODE_OAUTH_TOKEN, MEGA_CI_APP_PK, and the generated repository app token; this new ref then checks out the contributor-controlled PR head before invoking claude-pr-review. Because the condition at lines 62–64 permits any commenter except mega-maxwell[bot], an untrusted user can trigger a secret-bearing AI job over attacker-controlled repository content, unlike the existing pull_request path where fork-triggered runs do not receive repository secrets. Avoid checking out the PR head in this privileged event, or restrict the trigger and fork handling to a trusted workflow design.
Useful? React with 👍 / 👎.
| (github.event_name == 'issue_comment' && | ||
| github.event.issue.pull_request != null && | ||
| github.event.comment.user.login != 'mega-maxwell[bot]') |
There was a problem hiding this comment.
Trigger reconciliation for inline review replies
When a user replies directly to an inline Claude finding, GitHub emits pull_request_review_comment, not issue_comment; although this workflow subscribes to that event at lines 5–6, the new pr-review condition only accepts pull_request and issue_comment. Consequently, the common action of answering a finding in its review thread never starts the intended reconcile round; include the review-comment event while retaining the reviewer-bot guard to prevent self-triggering.
Useful? React with 👍 / 👎.
| (github.event_name == 'issue_comment' && | ||
| github.event.issue.pull_request != null && | ||
| github.event.comment.user.login != 'mega-maxwell[bot]') |
There was a problem hiding this comment.
Route @claude comments to only one job
When a trusted member posts a top-level PR comment containing @claude, the existing interactive condition at lines 17–21 and this new unconditional PR-comment branch both evaluate true, so the workflow launches claude-interactive and a full claude-pr-review concurrently for the same comment. This doubles model usage and allows two write-capable jobs to post or reconcile feedback against the same PR; exclude interactive trigger comments from this branch or otherwise route each comment to exactly one job.
Useful? React with 👍 / 👎.
Summary
Extends the
pr-reviewjob in.github/workflows/claude.ymlso a PR comment can trigger a Claude review reconcile round, in addition to the existing push-triggered reviews.Changes
Three changes to the
pr-reviewjob only (the interactive, doc-impact, label-check, and issue-triage jobs are untouched):issue_commenttrigger: theif:condition now also fires onissue_commentevents, gated so it only runs on comments attached to a PR (github.event.issue.pull_request != null). This leans on the sharedclaude-pr-reviewaction's newissue_commentsupport to reconcile open review questions/findings when someone answers in a PR comment.mega-maxwell[bot], is skipped so Claude does not re-trigger on its own review comments.github.event.issue.numberwhengithub.event.pull_request.numberis absent (as it is on comment events), keeping one review per PR regardless of trigger.actions/checkoutstep now checks outrefs/pull/{issue.number}/headonissue_commentevents. Without this the reviewer would readmaininstead of the PR branch, since a comment payload carries no PR ref.Push-triggered reviews (
opened/synchronize/ready_for_review/reopened) are unchanged — the existing condition is preserved verbatim, just OR'd with the new branch.The
on:block already hadissue_comment: [created](used by the interactive @claude job) and was not modified.Relates to megaeth-labs/.github#8.
🤖 Generated with Claude Code