Skip to content

Allowing multiple specialized bot in the same PR (using smart invisible tags)#780

Open
FreCap wants to merge 7 commits intoanthropics:mainfrom
FreCap:pr-411
Open

Allowing multiple specialized bot in the same PR (using smart invisible tags)#780
FreCap wants to merge 7 commits intoanthropics:mainfrom
FreCap:pr-411

Conversation

@FreCap
Copy link

@FreCap FreCap commented Dec 31, 2025

Allowing multiple Claude Reviewers in the same PR by changing the bot_name (e.g. security_review vs science_skills)

  Usage Example

  Configure each workflow with a unique bot_name:

  # .github/workflows/claude-code-review.yml
  - uses: anthropics/claude-code-action@main
    with:
      github_token: ${{ secrets.GITHUB_TOKEN }}
      use_sticky_comment: true
      bot_name: "claude-code-review"  # Unique identifier

  # .github/workflows/claude-security-review.yml
  - uses: anthropics/claude-code-action@main
    with:
      github_token: ${{ secrets.GITHUB_TOKEN }}
      use_sticky_comment: true
      bot_name: "claude-security"  # Different identifier

Implementation detail

Adding an hidden Header Identification (src/github/operations/comments/common.ts)
- Adds header when useStickyComment=true
- Invisible to users, used for bot identification

Following up on the previous request #411 with a simplified approach

  Critical fix for multi-bot support. When multiple bots use the same bot ID
  (e.g., Claude's official bot ID 41898282), they were matching each other's
  comments due to the OR logic in comment matching.

  New logic:
  - If comment has a hidden header, require BOTH header AND ID to match
  - This prevents Bot A from matching Bot B's comment when they share an ID
  - Maintains backward compatibility for old comments without headers

  Without this fix, claude-security and claude-code-review would overwrite
  each other's comments.
@TosinAF
Copy link

TosinAF commented Jan 4, 2026

related issue -- #419

@TosinAF
Copy link

TosinAF commented Jan 4, 2026

here's my take on this -- #789

- Add pagination to fetch all comments (fixes PRs with 30+ comments)
- Use case-insensitive, whitespace-tolerant regex for header matching
- Replace exact body match with content-based matching for legacy comments
- Add comprehensive test coverage for sticky comment scenarios
The updateCommentBody() function was stripping the <!-- bot: {botName} -->
header when transforming the comment body after Claude finishes. This caused
duplicate comments on subsequent PR pushes since the sticky comment matching
could not find the header.

Now the function extracts and preserves the bot header from the original
comment body, prepending it to the final result.
- Error case with bot header
- Combined with branch/PR links
- Header not at start of comment (security)
- Complex bot names with hyphens, underscores, numbers
The MCP update_claude_comment tool was overwriting the entire comment
body without preserving the <!-- bot: name --> header, causing sticky
comment matching to fail on subsequent PR pushes.

- Extract extractBotHeader() into shared utility in common.ts
- Update MCP server to fetch current comment and preserve header
- Update comment-logic.ts to use shared utility
- Add 10 tests for extractBotHeader including MCP simulation test
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.

2 participants