Skip to content

ci: let PR comments trigger a Claude review reconcile round - #361

Merged
Troublor merged 1 commit into
mainfrom
william/ci/pr-review-comment-trigger
Jul 31, 2026
Merged

ci: let PR comments trigger a Claude review reconcile round#361
Troublor merged 1 commit into
mainfrom
william/ci/pr-review-comment-trigger

Conversation

@Troublor

Copy link
Copy Markdown
Collaborator

Summary

Extends the pr-review job in .github/workflows/claude.yml so a PR comment can trigger a Claude review reconcile round, in addition to the existing push-triggered reviews.

Changes

Three changes to the pr-review job only (the interactive, doc-impact, label-check, and issue-triage jobs are untouched):

  • issue_comment trigger: the if: condition now also fires on issue_comment events, gated so it only runs on comments attached to a PR (github.event.issue.pull_request != null). This leans on the shared claude-pr-review action's new issue_comment support to reconcile open review questions/findings when someone answers in a PR comment.
  • Non-maxwell guard: comments from any human or bot are allowed; only the reviewer bot itself, mega-maxwell[bot], is skipped so Claude does not re-trigger on its own review comments.
  • Concurrency fallback: the concurrency group now falls back to github.event.issue.number when github.event.pull_request.number is absent (as it is on comment events), keeping one review per PR regardless of trigger.
  • PR-head checkout on comment events: the actions/checkout step now checks out refs/pull/{issue.number}/head on issue_comment events. Without this the reviewer would read main instead 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 had issue_comment: [created] (used by the interactive @claude job) and was not modified.

Relates to megaeth-labs/.github#8.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 31, 2026 05:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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
@mega-maxwell

mega-maxwell Bot commented Jul 31, 2026

Copy link
Copy Markdown

Claude review status

Living comment — rewritten in place. The review workflow keeps this single comment up to date instead of posting a new one each round, so it always describes the latest reviewed commit and the earlier text is intentionally gone. No reply is needed here; reply to a finding in its own review thread, and answer an open question in a reply on this PR. The next review round reconciles your answer.

🛠️ Review did not finish

Attempted head 5ed1be6c · updated 2026-07-31T05:44:18+00:00

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.

@github-actions

Copy link
Copy Markdown

🧬 Mutation testing — ✅ PASS

Nothing to test — no mutants were generated on the changed lines.

@github-actions

Copy link
Copy Markdown

🧬 Mutation testing

No results at target/mutants/mutants.out — nothing was mutated (e.g. no mutatable changes).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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) || '' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +62 to +64
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request != null &&
github.event.comment.user.login != 'mega-maxwell[bot]')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +62 to +64
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request != null &&
github.event.comment.user.login != 'mega-maxwell[bot]')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@Troublor
Troublor merged commit 4de1590 into main Jul 31, 2026
45 of 48 checks passed
@Troublor
Troublor deleted the william/ci/pr-review-comment-trigger branch July 31, 2026 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants