Summary
The exact failure mode #312 described — claude-code-review.yml's "Post review comment" step republishing the reviewer's own raw shell command instead of the review text — recurred on PR #380, in a form the unwrap_posted_body fix from #318 doesn't catch.
Evidence
Seen on Morrison-Lab/gha#380, run 30530903965.
The reviewer initially posted a placeholder comment (test-can-i-post, then edited to placeholder - real review incoming), then used a Bash tool call to edit that same comment into its real review via:
gh pr comment 380 --repo Morrison-Lab/gha --edit-last --body '## Code review
...
**Verdict: Ready for merge** ...'
That edit worked correctly — the claude[bot] comment ended up showing the rendered review text, verdict included.
But separately, the workflow's own "Post review comment" step (which extracts review_text_file from the execution output and reposts it via gh pr comment as github-actions[bot]) posted the literal command above, verbatim, as a new comment — not the review text it wrapped. So the PR again ended up with the review twice: once rendered correctly (claude[bot]), once as an unrendered shell command (github-actions[bot]) — the same duplicate-and-garbled pattern #312 reported.
Why #318's fix doesn't catch this
#318's unwrap_posted_body in check-review-execution.sh specifically matches the heredoc form:
gh pr comment N --body "$(cat <<'EOF'
...
EOF
)"
This occurrence uses a different shape entirely — --edit-last --body '...' with a single-quoted literal string, no heredoc at all. The regex that extracts heredoc contents has nothing to unwrap here, so the whole command (including --edit-last) passes through as the "review text" unchanged.
Suggested fix
Generalize unwrap_posted_body (or add a sibling case) to also recognize a plain gh (pr|issue) comment ... --body '...' / --body "..." invocation (with or without --edit-last) and extract the quoted argument, not just the heredoc form. Both shapes are "the reviewer posted its own comment via Bash instead of returning prose," so the fix should probably key on "this Bash tool_use block's command matches gh (pr|issue) comment" generally and try several known argument shapes, rather than only the heredoc one.
Worth adding a regression fixture with this --edit-last --body '...' shape alongside the existing heredoc fixture, so both variants are pinned.
Related
Summary
The exact failure mode #312 described —
claude-code-review.yml's "Post review comment" step republishing the reviewer's own raw shell command instead of the review text — recurred on PR #380, in a form theunwrap_posted_bodyfix from #318 doesn't catch.Evidence
Seen on
Morrison-Lab/gha#380, run 30530903965.The reviewer initially posted a placeholder comment (
test-can-i-post, then edited toplaceholder - real review incoming), then used a Bash tool call to edit that same comment into its real review via:That edit worked correctly — the
claude[bot]comment ended up showing the rendered review text, verdict included.But separately, the workflow's own "Post review comment" step (which extracts
review_text_filefrom the execution output and reposts it viagh pr commentasgithub-actions[bot]) posted the literal command above, verbatim, as a new comment — not the review text it wrapped. So the PR again ended up with the review twice: once rendered correctly (claude[bot]), once as an unrendered shell command (github-actions[bot]) — the same duplicate-and-garbled pattern #312 reported.Why #318's fix doesn't catch this
#318's
unwrap_posted_bodyincheck-review-execution.shspecifically matches the heredoc form:This occurrence uses a different shape entirely —
--edit-last --body '...'with a single-quoted literal string, no heredoc at all. The regex that extracts heredoc contents has nothing to unwrap here, so the whole command (including--edit-last) passes through as the "review text" unchanged.Suggested fix
Generalize
unwrap_posted_body(or add a sibling case) to also recognize a plaingh (pr|issue) comment ... --body '...'/--body "..."invocation (with or without--edit-last) and extract the quoted argument, not just the heredoc form. Both shapes are "the reviewer posted its own comment via Bash instead of returning prose," so the fix should probably key on "this Bashtool_useblock's command matchesgh (pr|issue) comment" generally and try several known argument shapes, rather than only the heredoc one.Worth adding a regression fixture with this
--edit-last --body '...'shape alongside the existing heredoc fixture, so both variants are pinned.Related
claude-code-reviewcan post the reviewer's rawgh pr commentheredoc instead of the review body #312 (closed as fixed by Fix claude-code-review republishing a raw gh pr comment as the review body #318) — same underlying class of bug, narrower fix.