Skip to content

feat(pr-review): let a PR comment trigger a reconcile round - #8

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

feat(pr-review): let a PR comment trigger a reconcile round#8
Troublor merged 1 commit into
mainfrom
fix/pr-review-comment-trigger

Conversation

@Troublor

Copy link
Copy Markdown
Collaborator

Fix A — answering a question without a push

Follow-up to #7. Before this, the pr-review action only ran on pull_request events, so answering an open question in a PR comment did nothing until the next push. This lets a repo opt a comment into driving a review round — while making sure routine chatter doesn't burn a review.

How it works

  • prepare accepts --event-name. On an issue_comment event, a comment never adds code to review, so it can only ever produce a reconcile-only incremental round or a skip — never a full review.
  • Cheap gate (manifest_has_open_items): it skips unless the manifest still has an open question or open finding — something a comment could answer, justify, or invalidate (per the design discussion, findings count too, not just questions). Most comments skip for the cost of a few API calls; no Opus run.
  • History preserved: when it does run, it's incremental and reuses the same sticky-comment manifest, so the reviewer keeps full prior context — the reason not to use @claude (which starts fresh). Runs on the cheaper incremental tier.
  • Silent when irrelevant: if the round changes nothing, the publisher posts nothing (no new review/notification).
  • Head unchanged → empty delta, reconcile-only; a comment that races a push reviews the new delta too.

Consumer opt-in

Per-repo, in claude.yml (documented in actions/README.md):

on:
  pull_request: { types: [opened, synchronize, ready_for_review, reopened] }
  issue_comment: { types: [created] }
jobs:
  pr-review:
    if: >-
      github.event_name != 'issue_comment' ||
      (github.event.issue.pull_request != null &&
       github.event.comment.user.type != 'Bot')
    concurrency:
      group: claude-pr-review-${{ github.event.pull_request.number || github.event.issue.number }}
      cancel-in-progress: false

Without the issue_comment trigger, behaviour is unchanged.

Tests

Gate helper + action wiring covered; full suite green (80 tests). YAML valid, pipeline compiles.

Follow-up (separate PR)

Wiring the issue_comment trigger into grafana-dashboard's claude.yml (the repo where this was observed) so the flow is live there.

🤖 Generated with Claude Code

Fix A of the open-question workflow. Before this, the reviewer only ran on
`pull_request` events, so answering an open question in a PR comment did
nothing until the next push (and even then #7 was needed for the answer to
register). This lets a consumer opt a comment into driving a review round.

- review_pipeline.py:
  - `prepare` accepts `--event-name`. On an `issue_comment` event a comment
    never adds code to review, so it can only run a reconcile-only incremental
    round — and only when the manifest still has an open question or finding
    (something a comment could answer, justify, or invalidate). Otherwise it
    skips, so routine chatter does not spend a review.
  - `manifest_has_open_items` is the gate.
  - When the head has not moved the delta is empty and the round exists purely
    to reconcile the new discussion; a comment that races a push reviews the
    new delta too. The round reuses the same sticky-comment manifest (full
    prior context) and runs on the cheaper incremental tier; if nothing
    changes the publisher posts nothing.
- action.yml: pass `--event-name`, and fall back to `github.event.issue.number`
  for the PR number on comment events.
- README: document the opt-in consumer snippet (issue_comment trigger, the
  human-only `if:` guard, and the issue.number concurrency fallback) and the
  cheap gating.
- tests: cover the gate helper and the action wiring.

Consumers opt in per repo by adding the `issue_comment` trigger to their
`claude.yml`; without it, behaviour is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GCc8MLBBAp5jAxc2x19swa
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.

1 participant