fix(review): deny reviewer gh pr comment so it stops duplicate-posting the review - #400
Conversation
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The reviewer agent self-posted its `## Code review` summary via `gh pr comment` (as claude[bot]) while the workflow's "Post review comment" step also posted it (as github-actions[bot]), so every review round left two top-level comments. Three places claimed `gh pr comment` was "not granted / denied", but it was only absent from the allowlist -- the code-review plugin's command frontmatter re-granted it, and nothing in --disallowedTools took it away. - Deny `Bash(gh pr comment:*)` in run-claude-review-attempt's --disallowedTools, and reword the reviewer prompt to OUTPUT its review (findings + Verdict) as its final message instead of posting a top-level comment. The workflow posts it, with run-link header, collapse, and cost linkage the self-post lacked. - Switch the prior-review-context fetch and the collapse step to match the github-actions[bot] author the workflow posts under (both admit claude[bot] too, for tag-mode tracking comments). The collapse step previously matched claude[bot] alone, so it silently folded nothing in agent mode. - Correct the stale "not granted / necessarily denied" comments in the composite header and check-review-execution.sh. Retires the raw-gh-pr-comment-republishing class (#312, #318, #381): with the tool denied the agent never issues the command, so there is nothing to republish. Closes #381. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Code reviewReviewed the fix for the duplicate-review-comment bug (#381): denying Verified:
Findings (both minor, posted inline):
Not flagged (judged non-blocking): the job-level comment at No bugs, no CLAUDE.md violations, no hallucinated APIs/symbols found. The GitHub Actions permission precedence claims that are checkable were checkable, and the one that isn't is disclosed as such. VerdictReady for merge (once the two inline grammar nits are optionally addressed — neither is blocking). |
|
Claude finished review — View run Review posted. Summary: Findings: two minor grammar nits (identical missing-conjunction run-on sentence) posted inline at Verification performed:
VerdictReady for merge — no bugs or CLAUDE.md violations found; only two non-blocking grammar polish suggestions. |
Live verification (agent mode, real review) ✅The one claim the round-1 review flagged as unverifiable pre-merge -- that Setup: a throwaway dispatch-only caller pointed at this branch ( Results:
Runs (rpt): round 1, round 2. (A first attempt surfaced that rpt's Since this workflow can't self-verify on its own PR (the |
Closes #381.
Problem
Every
claude-code-reviewrun posts the review twice: once asclaude[bot](the reviewer agent's own## Code reviewself-post) and once asgithub-actions[bot](the workflow's "Post review comment" step). Seen onMorrison-Lab/ai-config#1104and, in the raw-command-republishing variant, on gha#380 (#381) and gha#312.Root cause
The reviewer's
gh pr commentself-post channel was documented as blocked in three places (this composite's header,check-review-execution.sh, and ghaCLAUDE.md) but never actually wired up:--disallowedToolsnever listed it, and the upstreamcode-reviewplugin's command frontmatter re-grantsBash(gh pr comment:*). So the agent self-posts the summary asclaude[bot], and the workflow re-posts the extracted text asgithub-actions[bot].The
claude[bot]self-post is the strictly worse of the two: it carries no run-link header, is never folded by the collapse step (which matches on the workflow's run URL), isn't cost-linked, and bypasses the stub/verdict guard. So the fix keeps thegithub-actions[bot]post canonical and removes the self-post.Fix
Bash(gh pr comment:*)to the reviewer's--disallowedTools-- the guard the code already assumed existed.### Verdict) as its final message instead of posting a top-level comment; the workflow posts it. Inline comments (the inline-comment tool) are untouched. This also fixes a latent quality bug where the workflow sometimes re-posted only the agent's short "Review complete" recap instead of the full review, because the agent had already self-posted the real one (round 2 of ai-config#1104).claude-code-reviewcan post the reviewer's rawgh pr commentheredoc instead of the review body #312/Fix claude-code-review republishing a raw gh pr comment as the review body #318/claude-code-review still republishes a raw gh pr comment invocation as the review body (--edit-last variant, gha#312 regression) #381'sunwrap_posted_bodyrepublishing class moot: the agent never callsgh pr comment, so there is never a raw command to republish.Verification note
This depends on
--disallowedToolsoverriding a slash-command's frontmatterallowed-tools(deny beats allow in Claude Code's permission model; gha's own comments already assert "disallowed beats the action's generated allow-list"). It can only be confirmed on a live review run after@v2slides -- per this repo's "a PR fixing the review workflow can't self-verify before merge" gap.🤖 Generated with Claude Code