Skip to content

Add step to delete previous Claude review comments#1253

Merged
sbryngelson merged 1 commit intoMFlowCode:masterfrom
sbryngelson:pr-keepgoing
Feb 23, 2026
Merged

Add step to delete previous Claude review comments#1253
sbryngelson merged 1 commit intoMFlowCode:masterfrom
sbryngelson:pr-keepgoing

Conversation

@sbryngelson
Copy link
Member

@sbryngelson sbryngelson commented Feb 23, 2026

CodeAnt-AI Description

Remove prior Claude review comment before running review and ensure updated review posted

What Changed

  • The workflow now deletes an existing "Claude Code Review" PR comment before running a new review so the review action runs and posts fresh output.
  • If a prior review exists, the instructions require posting an updated top-level comment including the current head SHA, files changed count (up to 15), a 3–6 bullet summary, and findings or at least 3 improvement opportunities.
  • The review step will always produce one top-level PR comment (new or updated) rather than being stopped by an existing comment.

Impact

✅ Clearer updated review comments
✅ Fewer duplicate review comments
✅ Always-posted fresh review output

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • Chores
    • Updated code review workflow to remove outdated review comments before posting new ones, ensuring cleaner PR discussion threads.
    • Enhanced code review formatting to consistently display updated comments with file change summaries and improvement suggestions.

Added a step to remove prior Claude review comments before running a new review.
Copilot AI review requested due to automatic review settings February 23, 2026 03:19
@codeant-ai
Copy link
Contributor

codeant-ai bot commented Feb 23, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@sbryngelson sbryngelson merged commit e36eb61 into MFlowCode:master Feb 23, 2026
20 of 21 checks passed
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 23, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR modifies the Claude code review GitHub Actions workflow to automatically remove prior review comments before initiating new reviews, and updates the review prompt to generate an "updated" comment containing current metadata, file counts, change summaries, and improvement opportunities.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/claude-code-review.yml
Added step to delete prior Claude review comments via GitHub API. Extended review prompt with instructions to post an "updated" review comment when prior reviews exist, including head SHA, file change counts with up to 15 file paths, 3–6 bullet change summaries, and 3–6 improvement opportunities with file path references.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

size:S

Poem

🐰 Hop! The reviewer's old notes fade away,
Fresh eyes, new comments brighten the day,
SHA checksums and file paths so clear,
Claude's wisdom returns, without any fear!

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codeant-ai codeant-ai bot added the size:S This PR changes 10-29 lines, ignoring generated files label Feb 23, 2026
@codeant-ai
Copy link
Contributor

codeant-ai bot commented Feb 23, 2026

CodeAnt AI finished reviewing your PR.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds workflow logic to remove a prior “Claude Code Review” PR comment before re-running the Claude review action, and updates the Claude prompt to guide posting an updated review.

Changes:

  • Added a GitHub CLI step to find/delete an existing “Claude Code Review” issue comment on the PR.
  • Expanded the Claude instruction prompt to prefer posting a new “updated” review comment with additional metadata.

Comment on lines +24 to +37
- name: Remove prior Claude review comment (so review runs again)
env:
GH_TOKEN: ${{ github.token }}
run: |
pr=${{ github.event.pull_request.number }}
repo=${{ github.repository }}

# Find first issue comment whose body starts with "## Claude Code Review"
comment_id=$(gh api repos/$repo/issues/$pr/comments \
--jq '.[] | select(.body | startswith("## Claude Code Review")) | .id' | head -n 1)

if [ -n "$comment_id" ]; then
echo "Deleting prior Claude review comment id=$comment_id"
gh api -X DELETE repos/$repo/issues/comments/$comment_id
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

This deletes only a single matching comment (the first one returned), but the PR title implies removing previous Claude review comments (potentially multiple). Consider deleting all matching comment IDs (iterate over the jq output) or explicitly deleting only the most recent one and updating the step/title to match that behavior.

Suggested change
- name: Remove prior Claude review comment (so review runs again)
env:
GH_TOKEN: ${{ github.token }}
run: |
pr=${{ github.event.pull_request.number }}
repo=${{ github.repository }}
# Find first issue comment whose body starts with "## Claude Code Review"
comment_id=$(gh api repos/$repo/issues/$pr/comments \
--jq '.[] | select(.body | startswith("## Claude Code Review")) | .id' | head -n 1)
if [ -n "$comment_id" ]; then
echo "Deleting prior Claude review comment id=$comment_id"
gh api -X DELETE repos/$repo/issues/comments/$comment_id
- name: Remove prior Claude review comments (so review runs again)
env:
GH_TOKEN: ${{ github.token }}
run: |
pr=${{ github.event.pull_request.number }}
repo=${{ github.repository }}
# Find all issue comments whose body starts with "## Claude Code Review"
comment_ids=$(gh api repos/$repo/issues/$pr/comments \
--jq '.[] | select(.body | startswith("## Claude Code Review")) | .id')
if [ -n "$comment_ids" ]; then
echo "Deleting prior Claude review comments:"
echo "$comment_ids" | while read -r comment_id; do
if [ -n "$comment_id" ]; then
echo " - Deleting comment id=$comment_id"
gh api -X DELETE repos/$repo/issues/comments/$comment_id
fi
done

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +33
# Find first issue comment whose body starts with "## Claude Code Review"
comment_id=$(gh api repos/$repo/issues/$pr/comments \
--jq '.[] | select(.body | startswith("## Claude Code Review")) | .id' | head -n 1)
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The GitHub API response order for issue comments isn’t guaranteed to be the one you intend, so head -n 1 can delete an arbitrary matching comment. If the goal is to delete the latest/previous Claude comment, filter + sort by .created_at (or .updated_at) and then select the newest ID deterministically.

Suggested change
# Find first issue comment whose body starts with "## Claude Code Review"
comment_id=$(gh api repos/$repo/issues/$pr/comments \
--jq '.[] | select(.body | startswith("## Claude Code Review")) | .id' | head -n 1)
# Find most recent issue comment whose body starts with "## Claude Code Review"
comment_id=$(gh api repos/$repo/issues/$pr/comments \
--jq 'map(select(.body | startswith("## Claude Code Review"))) | sort_by(.created_at) | last? | .id // empty')

Copilot uses AI. Check for mistakes.

IMPORTANT:
- Do NOT stop just because a previous "Claude Code Review" comment exists.
- If a prior Claude review exists, post a NEW comment titled "Claude Code Review (updated)" that includes:
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

GitHub PR issue comments don’t support a separate 'title' field—only the body text. If you need a 'title', instruct Claude to include a first-line markdown heading (e.g., ## Claude Code Review (updated)) or a consistent prefix in the comment body, rather than referring to the comment as being 'titled'.

Copilot uses AI. Check for mistakes.
- files changed count + up to 15 file paths
- 3–6 bullet summary of changes
- findings or at least 3 improvement opportunities with file paths
Post as ONE top-level PR comment.
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

GitHub PR issue comments don’t support a separate 'title' field—only the body text. If you need a 'title', instruct Claude to include a first-line markdown heading (e.g., ## Claude Code Review (updated)) or a consistent prefix in the comment body, rather than referring to the comment as being 'titled'.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files

Development

Successfully merging this pull request may close these issues.

2 participants