Skip to content

Conversation

@shuhuiluo
Copy link
Collaborator

@shuhuiluo shuhuiluo commented Dec 19, 2025

When user subscribes to review_comments, PR conversation comments (from the Conversation tab) are now also delivered. This matches user expectation that review_comments covers all PR comments.

  • Issue comments still only match "comments" subscribers
  • Inline code review comments still only match "review_comments"
  • PR conversation comments now match both

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Webhook routing updated so channels subscribed to review_comments also receive PR conversation comments, improving delivery accuracy for PR discussions.
  • Documentation

    • Clarified event descriptions: issue_comment now covers both issues and PR conversation comments; pull_request_review_comment clarified as inline PR review comments.
  • Tests

    • Expanded unit tests to cover PR comment routing and multiple subscriber scenarios.

✏️ Tip: You can customize this high-level summary in your review settings.

When user subscribes to review_comments, PR conversation comments
(from the Conversation tab) are now also delivered. This matches
user expectation that review_comments covers all PR comments.

- Issue comments still only match "comments" subscribers
- Inline code review comments still only match "review_comments"
- PR conversation comments now match both

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Dec 19, 2025

Walkthrough

The PR updates event routing so an issue_comment payload tied to a pull request (has pull_request / parentType PR) is treated as matching channels subscribed to review_comments in addition to comments. It adjusts channel-selection logic accordingly, adds unit tests covering PR comment routing, and updates README text clarifying how issue_comment and pull_request_review_comment events are routed and threaded.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review the conditional change in src/github-app/event-processor.ts that includes PR-linked issue_comment events for review_comments subscriptions.
  • Run and inspect new/updated tests in tests/unit/github-app/event-processor.test.ts for correctness and coverage of edge cases.
  • Verify README updates reflect the implemented routing semantics.
  • Pay attention to payload-shape edge cases (presence/absence of pull_request / parentType) and ensure no unintended matches.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: PR conversation comments are now included for review_comments subscribers. This directly matches the primary objective and code changes in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/review-comments-include-pr-comments

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c0624a9 and 6bfd54f.

📒 Files selected for processing (2)
  • README.md (2 hunks)
  • tests/unit/github-app/event-processor.test.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/unit/github-app/event-processor.test.ts
  • README.md

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2497d2 and 74fa655.

📒 Files selected for processing (1)
  • src/github-app/event-processor.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: Store context externally - maintain stateless bot architecture with no message history, thread context, or conversation memory
Use <@{userId}> for mentions in messages AND add mentions in sendMessage options - do not use @username format
Implement event handlers for onMessage, onSlashCommand, onReaction, onTip, and onInteractionResponse to respond to Towns Protocol events
Define slash commands in src/commands.ts as a const array with name and description properties, then register handlers using bot.onSlashCommand()
Set ID in interaction requests and match ID in responses to correlate form submissions, button clicks, and transaction/signature responses
Use readContract for reading smart contract state, writeContract for SimpleAccount operations, and execute() for external contract interactions
Fund bot.appAddress (Smart Account) for on-chain operations, not bot.botId (Gas Wallet/EOA)
Use bot.* handler methods directly (outside event handlers) for unprompted messages via webhooks, timers, or tasks - requires channelId, spaceId, or other context stored externally
Always check permissions using handler.hasAdminPermission() before performing admin operations like ban, redact, or pin
User IDs are hex addresses in format 0x..., not usernames - use them consistently throughout event handling and message sending
Slash commands do not trigger onMessage - register slash command handlers using bot.onSlashCommand() instead
Use getSmartAccountFromUserId() to retrieve a user's wallet address from their userId
Include required environment variables: APP_PRIVATE_DATA (bot credentials) and JWT_SECRET (webhook security token)

Files:

  • src/github-app/event-processor.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Provide alt text for image attachments and use appropriate MIME types for chunked attachments (videos, screenshots)

Files:

  • src/github-app/event-processor.ts

Add unit tests verifying:
- comments subscribers receive PR conversation comments
- review_comments subscribers receive PR conversation comments
- review_comments subscribers do NOT receive issue comments

Update README to document comment routing behavior.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@shuhuiluo shuhuiluo force-pushed the feat/review-comments-include-pr-comments branch from c0624a9 to 6bfd54f Compare December 19, 2025 21:54
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 74fa655 and c0624a9.

📒 Files selected for processing (2)
  • README.md (2 hunks)
  • tests/unit/github-app/event-processor.test.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: Store context externally - maintain stateless bot architecture with no message history, thread context, or conversation memory
Use <@{userId}> for mentions in messages AND add mentions in sendMessage options - do not use @username format
Implement event handlers for onMessage, onSlashCommand, onReaction, onTip, and onInteractionResponse to respond to Towns Protocol events
Define slash commands in src/commands.ts as a const array with name and description properties, then register handlers using bot.onSlashCommand()
Set ID in interaction requests and match ID in responses to correlate form submissions, button clicks, and transaction/signature responses
Use readContract for reading smart contract state, writeContract for SimpleAccount operations, and execute() for external contract interactions
Fund bot.appAddress (Smart Account) for on-chain operations, not bot.botId (Gas Wallet/EOA)
Use bot.* handler methods directly (outside event handlers) for unprompted messages via webhooks, timers, or tasks - requires channelId, spaceId, or other context stored externally
Always check permissions using handler.hasAdminPermission() before performing admin operations like ban, redact, or pin
User IDs are hex addresses in format 0x..., not usernames - use them consistently throughout event handling and message sending
Slash commands do not trigger onMessage - register slash command handlers using bot.onSlashCommand() instead
Use getSmartAccountFromUserId() to retrieve a user's wallet address from their userId
Include required environment variables: APP_PRIVATE_DATA (bot credentials) and JWT_SECRET (webhook security token)

Files:

  • tests/unit/github-app/event-processor.test.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Provide alt text for image attachments and use appropriate MIME types for chunked attachments (videos, screenshots)

Files:

  • tests/unit/github-app/event-processor.test.ts
🪛 GitHub Actions: CI
tests/unit/github-app/event-processor.test.ts

[warning] 1-1: Code style issues found in file by Prettier. Run 'prettier --write' to fix.

🔇 Additional comments (7)
README.md (2)

71-72: Clear documentation of comment routing behavior.

The explanation effectively clarifies how PR conversation comments are routed to both comments and review_comments subscribers, and provides useful context on the use case for PR-focused subscriptions.


114-116: Event routing documentation is accurate and consistent.

The descriptions of issue_comment and pull_request_review_comment events align well with the routing behavior explained in the note above.

tests/unit/github-app/event-processor.test.ts (5)

145-165: Well-structured test helper for PR comment payloads.

The createIssueCommentPayload helper correctly mimics GitHub's behavior of including the pull_request field only for PR comments, making the test setup clear and accurate.


168-200: Excellent mock service setup.

The createMocks helper provides clean, reusable test infrastructure that captures delivery behavior for verification while keeping test cases focused and readable.


202-210: Test correctly verifies comments subscriber receives PR comment.


212-230: Critical test coverage for new routing behavior.

These tests correctly verify that:

  1. PR conversation comments are now delivered to review_comments subscribers (the new feature)
  2. Regular issue comments remain excluded from review_comments subscriptions (preserving the intended filtering)

232-254: Comprehensive edge case coverage.

These tests validate important scenarios:

  1. Multiple subscribers with different event types both receive the same PR comment
  2. Channels without comment-related subscriptions are properly filtered out

The test suite now provides excellent coverage of the PR comment routing feature.

@shuhuiluo shuhuiluo merged commit 1430e51 into main Dec 19, 2025
2 checks passed
@shuhuiluo shuhuiluo deleted the feat/review-comments-include-pr-comments branch December 19, 2025 22:26
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