-
Notifications
You must be signed in to change notification settings - Fork 0
fix: add missing review_comments webhook handler #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add PullRequestReviewCommentPayload type - Add formatPullRequestReviewComment formatter - Add onPullRequestReviewComment handler in EventProcessor - Register pull_request_review_comment webhook Now review_comments events are delivered via webhooks (previously polling-only). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
WalkthroughThe PR adds support for processing pull request review comment webhook events across the application. It introduces a new type Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/formatters/webhook-events.ts (1)
183-201: Review comment formatter aligns with existing patterns; minor reuse opportunityThe
formatPullRequestReviewCommentimplementation correctly:
- Handles only
"created"actions.- Builds a concise, first-line, 100-char preview.
- Uses the same markdown style as other formatters.
There’s some duplication with
formatIssueCommentin how comments are truncated; you could later extract a small helper for “shortComment” formatting if this pattern spreads further, but it’s not required now.src/github-app/event-processor.ts (1)
12-13: Review comment handler is consistent with existing PR event handlingThe additions cleanly extend the processor:
- Imports
formatPullRequestReviewCommentandPullRequestReviewCommentPayloadalongside existing PR/ review types.onPullRequestReviewCommentmirrorsonPullRequestReview, using the PR’s base branch for filtering and wiring throughprocessEventwith event type"review_comments"and an appropriate log context.This keeps behavior and branch filtering for review comments aligned with other PR-related events. If you see more PR-based event types accumulating, you might later factor out the repeated “base branch + processEvent” pattern, but it’s fine as-is.
Also applies to: 30-36, 237-251
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/formatters/webhook-events.ts(2 hunks)src/github-app/event-processor.ts(3 hunks)src/index.ts(1 hunks)src/types/webhooks.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/formatters/webhook-events.tssrc/types/webhooks.tssrc/index.tssrc/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/formatters/webhook-events.tssrc/types/webhooks.tssrc/index.tssrc/github-app/event-processor.ts
🧬 Code graph analysis (2)
src/formatters/webhook-events.ts (1)
src/types/webhooks.ts (1)
PullRequestReviewCommentPayload(21-22)
src/github-app/event-processor.ts (2)
src/types/webhooks.ts (1)
PullRequestReviewCommentPayload(21-22)src/formatters/webhook-events.ts (1)
formatPullRequestReviewComment(183-201)
🔇 Additional comments (3)
src/index.ts (1)
106-108: Webhook wiring for review comments matches existing patternThe new
pull_request_review_commentwebhook handler cleanly mirrors the other webhook registrations and correctly delegates toeventProcessor.onPullRequestReviewComment(payload). No issues from this change alone.src/formatters/webhook-events.ts (1)
6-19: Type import extension is consistent with existing payload importsIncluding
PullRequestReviewCommentPayloadin the type-only import list keeps this file’s typing pattern uniform with other webhook payloads.src/types/webhooks.ts (1)
21-22: New payload alias follows established webhook type pattern
PullRequestReviewCommentPayloadmirrors the otherWebhookPayload<...>aliases and cleanly exposes the new event type.
Now review_comments events are delivered via webhooks (previously polling-only).
🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.