Claude Code Keeps Replying to Its Own PR Comments? Stop the Loop

Claude Code Keeps Replying to Its Own PR Comments? Stop the Loop

Aident AI

An indigo review ribbon approaches a coral gate that diverts one repeated cyan loop into a quiet endpoint.

Claude Code Keeps Replying to Its Own PR Comments? Stop the Loop

If Claude Code's pull-request monitor keeps treating its own replies as new review feedback, stop the loop before it creates another comment or commit. Add a rule that fetches the exact GitHub comment and ignores any body ending with Claude Code's automated-reply marker. Then inspect the pull request read-only before resuming the monitor.

This is a containment workaround for an open Claude Code issue, not an upstream fix. The check happens after the event reaches the session, so it can prevent another reply and code change but cannot recover the turn already spent on the false dispatch.

Confirm the Failure Before Changing Anything

The August 7 report describes a specific cycle:

  1. Claude Code watches a pull request for review feedback.

  2. A real review comment arrives.

  3. Claude addresses it and posts a reply through the user's GitHub account.

  4. The monitor surfaces that reply as another new review comment.

  5. Claude tries to address its own reply, posts again, and repeats.

The reporter observed this four times in one session across two pull requests. The visible GitHub author is not enough to break the cycle because Claude Code's reply is posted through the user's credentials. A human comment and the automated reply can therefore have the same user.login value.

Use this guide when the new feedback is a reply Claude Code just posted and the reply carries the documented automated label. Do not use it to suppress a human review merely because the author matches the pull-request owner.

Stop the Current Loop Safely

Interrupt the active session or disable Auto-fix for the affected pull request. Do not delete comments, force-push, or manufacture a code change to satisfy the generic instruction to address feedback.

Before resuming, record:

  • the pull-request URL;

  • the latest dispatched comment ID and URL;

  • whether the comment is top-level or attached to a diff line;

  • whether its body ends with the Claude Code marker;

  • whether a code change or reply was already pushed for that dispatch.

Run git status --short and inspect the latest commit before reverting anything. The loop may have posted comment noise without changing code, or it may have produced a real fix on the first pass and unnecessary changes later. Review each result separately.

Add an Exact Marker Guard

Add this rule to ~/.claude/CLAUDE.md if you want it to apply across repositories, or to the repository's CLAUDE.md if the workaround should stay project-scoped:

## Pull-request feedback guard

When a pull-request monitor asks you to address review feedback, fetch the exact
GitHub comment before changing code, replying, or pushing.

If the comment body ends with
`_๐Ÿค– Addressed by [Claude Code](https://claude.com/claude-code)_`, classify it as
Claude Code's own automated reply. Do not change code, reply, push, or dispatch
another agent for that comment. Report that it was skipped and stop.

If the marker is absent, decide whether the feedback actually requires a code
change. An approval, observation, or process note does not justify a commit

Match the complete marker, including the link and trailing emphasis. A loose check for Claude Code could discard a real review that merely mentions the product.

This rule follows the upstream issue's working workaround. It consumes the signal Claude Code already appends to automated replies instead of trying to infer authorship from the GitHub username.

Fetch the Right Kind of GitHub Comment

GitHub exposes top-level pull-request comments and inline review comments through different endpoints. Use the endpoint that matches the URL or event payload.

For a top-level pull-request comment:

gh api repos/OWNER/REPO/issues/comments/COMMENT_ID \
  --jq '{id, automated: (.body | endswith("_๐Ÿค– Addressed by [Claude Code](https://claude.com/claude-code)_")), url: .html_url}'

For an inline review comment on a diff:

gh api repos/OWNER/REPO/pulls/comments/COMMENT_ID \
  --jq '{id, automated: (.body | endswith("_๐Ÿค– Addressed by [Claude Code](https://claude.com/claude-code)_")), url: .html_url}'

Expected output for Claude Code's own reply includes "automated": true. When it is false, read the exact comment in context before deciding whether any action is warranted.

Do not fetch every repository comment and filter by author. The useful evidence is the body of the exact event that triggered the session.

Why the Username Check Fails

Claude Code's Auto-fix documentation says replies are posted using the user's GitHub account and labeled as coming from Claude Code. That makes the marker the stronger discriminator:

Signal

Human review

Claude Code reply

Safe discriminator?

user.login is the PR owner

Possible

Possible

No

Comment appeared after a push

Possible

Possible

No

Body ends with the full marker

Unlikely

Expected

Yes, for this bug

The marker check should run before code edits, replies, commits, or pushes. Checking only after a change prevents neither noise nor duplicate work.

Verify the Guard Without Posting a Comment

Test the rule with saved, non-sensitive fixtures instead of creating another live reply:

marker='_๐Ÿค– Addressed by [Claude Code](https://claude.com/claude-code)_'

jq -n --arg body "Fixed and verified.\n\n$marker" --arg marker "$marker" \
  '{automated: ($body | endswith($marker))}'

jq -n --arg body 'Please add a regression test for the timeout.' --arg marker "$marker" \
  '{automated: ($body | endswith($marker))}'

Expected results:

  • the automated fixture returns true;

  • the human-review fixture returns false;

  • neither command touches GitHub;

  • no code, commit, or reply is created.

Then ask Claude Code to explain what it would do for each fixture without taking action. The marker fixture should stop. The human fixture should evaluate the request instead of assuming every comment requires a patch.

Do Not Confuse Auto-fix With Code Review

Claude Code has adjacent pull-request features with different behavior:

  • Auto-fix watches a pull request and can respond to CI failures and review comments.

  • Code Review analyzes a pull request and posts findings as inline comments.

  • A custom GitHub Action can also react to issue or review-comment events.

The reported loop concerns the monitor handling replies, not proof that every Claude Code review mode loops. Check which feature or workflow subscribed to the pull request before changing organization-wide settings.

Official Auto-fix guidance also warns that Claude's replies can trigger comment-driven automation. Review workflows that react to issue_comment, review-comment, or pull-request events, especially when a comment can deploy infrastructure or run a privileged job. Disable the watcher until the feedback path is idempotent.

Clean Up After the Loop

Once the guard is in place:

  1. List the comments created during the incident.

  2. Identify automated replies by the exact trailing marker.

  3. Review the branch diff and commits created after the first valid human comment.

  4. Keep legitimate fixes and report uncertain changes for human review.

  5. Do not delete GitHub comments or rewrite branch history automatically.

  6. Re-enable the monitor on one low-risk pull request first.

Success means one human comment causes at most one bounded response, an automated marker comment causes no code or reply, and a no-change observation does not produce a manufactured commit.

Check the Loop Read-Only With Aident Loadout

Start with the canonical setup instruction:

Follow https://aident.ai/SETUP.md

Then give your agent a read-only audit:

Check Aident Loadout authentication and Vault status. Discover the current GitHub Action that lists review comments on one pull request, inspect its input schema, and preflight the request for OWNER/REPO pull request NUMBER. If the input is valid and the estimate is free, execute it. Return the total comment count, the count whose bodies end with the exact Claude Code automated marker, and the count without that marker. Do not return full comment bodies. Do not post, edit, react to, resolve, or delete comments, and do not change the pull request or branch.

Set up Aident Loadout and audit one review loop without GitHub writes.

The measurable result is a typed, read-only inventory and three counts. A zero-marker result means this exact signature loop was not found; it does not prove that every review automation path is healthy.

Sources

Refresh this guide when issue 84761 is fixed or closed, when Claude Code changes the automated-reply marker, or when the monitor documents a server-side self-reply filter.

Home

Home

Home

Integrations

Integrations

Integrations

Vault

Vault

Vault

Audit

Audit

Audit

Arana Grande

Arana Grande

Arana Grande

Free

Free

Free

30-day audit summary

30-day audit summary

30-day audit summary

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

View Audit

View Audit

View Audit

Loadout usage

Loadout usage

Loadout usage

617 action calls in the last 30 days

617 action calls in the last 30 days

617 action calls in the last 30 days

May 19 - Jun 17

May 19 - Jun 17

May 19 - Jun 17

10 active days

10 active days

10 active days

Less

Less

Less

More

More

More

Recent activity

Recent activity

Recent activity

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Shopify

Shopify

Shopify

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Success

Success

Success

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Success

Success

Success

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Failed

Failed

Failed

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Connected integration coverage

Connected integration coverage

Connected integration coverage

162

162

162

of 753 accessible connected

of 753 accessible connected

of 753 accessible connected

Callable actions

Callable actions

Callable actions

1,126

1,126

1,126

Vault credentials

Vault credentials

Vault credentials

8

8

8

Explore what's possible

Explore what's possible

Explore what's possible

See all Integrations

See all Integrations

See all Integrations

Google Ads

Google Ads

Google Ads

All available Goolge Ads tools via...

All available Goolge Ads tools via...

All available Goolge Ads tools via...

X (twitter)

X (twitter)

X (twitter)

All available X tools via...

All available X tools via...

All available X tools via...

Github

Github

Github

All available Github tools via...

All available Github tools via...

All available Github tools via...

Notion

Notion

Notion

All available Notion tools via...

All available Notion tools via...

All available Notion tools via...

Slack

Slack

Slack

All available Slack tools via...

All available Slack tools via...

All available Slack tools via...

Firecrawl

Firecrawl

Firecrawl

All available Firecrawl tools via...

All available Firecrawl tools via...

All available Firecrawl tools via...

753 integrations are available for loadouts.

753 integrations are available for loadouts.

753 integrations are available for loadouts.

The one tool

for every tool

your agent needs.

Give any AI agent real capabilities in seconds. Connect 1,000+ tools once, skip the setup headache, and let your agents execute.

Try Aident Loadout

Give your Agent real capabilities in minutes. Connect 1,000+ tools, and let your agents execute.

Try Aident Loadout

Give your Agent real capabilities in minutes. Connect 1,000+ tools, and let your agents execute.

Try Aident Loadout

Give your Agent real capabilities in minutes. Connect 1,000+ tools, and let your agents execute.