Skip to content

feat(web): acknowledge review command comments with a reaction#1174

Open
fatmcgav wants to merge 4 commits intosourcebot-dev:mainfrom
fatmcgav:feat-ai-codereview-ack-comment
Open

feat(web): acknowledge review command comments with a reaction#1174
fatmcgav wants to merge 4 commits intosourcebot-dev:mainfrom
fatmcgav:feat-ai-codereview-ack-comment

Conversation

@fatmcgav
Copy link
Copy Markdown
Contributor

@fatmcgav fatmcgav commented May 5, 2026

Adds a configurable acknowledgment reaction/emoji to the triggering
comment when the review agent receives a review command, so users
get immediate feedback that the request was received.

  • github: reacts to the issue comment via the reactions API (default: eyes)
  • gitlab: awards an emoji on the MR note via MergeRequestNoteAwardEmojis
  • New REVIEW_AGENT_ACK_REACTION env var (default: eyes) controls the reaction
  • Acknowledgment failures are logged as warnings and do not block the review

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Summary by CodeRabbit

  • New Features

    • Added REVIEW_AGENT_ACK_REACTION environment variable (defaults to eyes) to configure the reaction used when the Review Agent acknowledges a review command.
    • Review Agent now applies an acknowledgement reaction to review command triggers on GitHub and GitLab.
  • Documentation

    • Updated environment variable reference and changelog to document the new reaction setting.

Adds a configurable acknowledgment reaction/emoji to the triggering
comment when the review agent receives a `/review` command, so users
get immediate feedback that the request was received.

- GitHub: reacts to the issue comment via the reactions API (default: `eyes`)
- GitLab: awards an emoji on the MR note via `MergeRequestNoteAwardEmojis`
- New `REVIEW_AGENT_ACK_REACTION` env var (default: `eyes`) controls the reaction
- Acknowledgment failures are logged as warnings and do not block the review

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6e340b96-1e65-48b3-9520-2eae345cc1b9

📥 Commits

Reviewing files that changed from the base of the PR and between f327c52 and 6ee674d.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • packages/web/src/app/api/(server)/webhook/route.ts
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/web/src/app/api/(server)/webhook/route.ts

Walkthrough

This PR adds a configurable acknowledgement reaction for the Review Agent. When a review command comment/note is received from GitHub or GitLab, the webhook attempts to add a reaction (emoji) to the triggering comment/note (configurable via REVIEW_AGENT_ACK_REACTION, default eyes) before continuing processing.

Changes

Review Agent Acknowledgment Reaction

Layer / File(s) Summary
Environment / Config
packages/shared/src/env.server.ts
Adds REVIEW_AGENT_ACK_REACTION with default "eyes" to the server environment schema and exported env mapping.
Data Shape / Types
packages/web/src/features/agents/review-agent/types.ts
gitLabNotePayloadSchema gains object_attributes.id: number, updating the inferred GitLabNotePayload type.
Core Integration (ack helper)
packages/web/src/app/api/(server)/webhook/route.ts
Adds ACK_TIMEOUT_MS = 1500 and ackWithTimeout helper that races an ack API call against a timeout and logs warnings on failure.
Webhook Wiring
packages/web/src/app/api/(server)/webhook/route.ts
Before processing a review command: for GitHub issue_comment events call octokit.rest.reactions.createForIssueComment(...) via ackWithTimeout; for GitLab Note Hook events call gitlabClient.MergeRequestNoteAwardEmojis.award(...) via ackWithTimeout. Failures/timeouts are logged and do not block subsequent processing.
Documentation
docs/docs/configuration/environment-variables.mdx, docs/docs/features/agents/review-agent.mdx, CHANGELOG.md
Add REVIEW_AGENT_ACK_REACTION (default eyes) to env var reference tables and changelog entry.

Sequence Diagram(s)

sequenceDiagram
    participant GitHost as GitHub/GitLab
    participant Webhook as Webhook Handler
    participant AckAPI as Reactions API
    participant Processor as Review Processor

    GitHost->>Webhook: issue_comment / Note Hook (review command)
    Webhook->>AckAPI: create reaction (uses env.REVIEW_AGENT_ACK_REACTION)
    alt ack succeeds within 1500ms
        AckAPI-->>Webhook: 200 OK
    else ack fails or times out
        AckAPI-->>Webhook: error/timeout (logged)
    end
    Webhook->>Processor: fetch PR/MR and invoke processGitHubPullRequest / processGitLabMergeRequest
    Processor-->>Webhook: processing result
    Webhook-->>GitHost: respond 200
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • brendan-kellam
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main feature: acknowledging review command comments with a reaction. It aligns with all code changes across configuration, documentation, types, and webhook implementation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

Copy link
Copy Markdown
Contributor

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/web/src/app/api/`(server)/webhook/route.ts:
- Around line 189-199: Wrap the best-effort acknowledgment calls in a timeout
wrapper so they don't block webhook processing: replace the direct await of
octokit.rest.reactions.createForIssueComment(...) (and the analogous GitLab ack
call) with a withTimeout or Promise.race that races the API promise against a
1500ms timeout promise, and proceed regardless of timeout or error; keep
existing error logging (logger.warn) for failures but ensure the handler
continues immediately when the timeout fires and do not await the ack
indefinitely—use the existing env.REVIEW_AGENT_ACK_REACTION and method
octokit.rest.reactions.createForIssueComment to locate the GitHub call and the
corresponding GitLab ack function to apply the same pattern.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c0ea19aa-2825-42c9-83a3-4ab2a5de8919

📥 Commits

Reviewing files that changed from the base of the PR and between a6116ca and f327c52.

📒 Files selected for processing (5)
  • docs/docs/configuration/environment-variables.mdx
  • docs/docs/features/agents/review-agent.mdx
  • packages/shared/src/env.server.ts
  • packages/web/src/app/api/(server)/webhook/route.ts
  • packages/web/src/features/agents/review-agent/types.ts

Comment thread packages/web/src/app/api/(server)/webhook/route.ts Outdated
Gavin Williams and others added 3 commits May 5, 2026 17:26
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant