Skip to content

feat: remove await keyword in webhook review functon call#60

Merged
afuhflynn merged 2 commits intomainfrom
feat/test
Dec 29, 2025
Merged

feat: remove await keyword in webhook review functon call#60
afuhflynn merged 2 commits intomainfrom
feat/test

Conversation

@afuhflynn
Copy link
Copy Markdown
Owner

@afuhflynn afuhflynn commented Dec 29, 2025

Summary by CodeRabbit

  • Chores
    • Removed an unused test file.
    • Webhook processing changed to run asynchronously so requests no longer block while background work completes.
    • Background event payloads now include stable identifiers for improved traceability; added a console log for installation events.

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 29, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The PR makes the GitHub webhook handler call to reviewPullRequest non-blocking (removes await) while keeping its .then/.catch logging. It also adds logging and explicit id fields to two Inngest event sends, and deletes test.txt.

Changes

Cohort / File(s) Summary
Webhook async control
app/api/webhooks/github/route.ts
Removed await from reviewPullRequest call so it runs asynchronously; existing .then/.catch retained (fire-and-forget pattern, logging on settlement).
AI actions / event payloads
lib/ai/actions/index.ts
Added console.log of the installation object and added explicit id fields to inngest.send for pr.summary.requested and pr.review.requested.
Test removal
test.txt
Deleted single-line test file.

Sequence Diagram(s)

sequenceDiagram
  participant GitHub
  participant Webhook as Webhook Handler
  participant Reviewer as reviewPullRequest
  participant Inngest as Inngest

  Note over GitHub,Webhook: Incoming PR webhook
  GitHub->>Webhook: POST /webhook (PR event)

  alt Previous (await)
    Webhook->>Reviewer: call reviewPullRequest() and await
    Reviewer->>Inngest: send events (pr.review.requested / pr.summary.requested)
    Reviewer-->>Webhook: resolves/rejects
    Webhook->>Webhook: continue response after await
  else New (fire-and-forget)
    Webhook->>Reviewer: call reviewPullRequest() (no await)
    Note right of Webhook: Handler continues and responds immediately
    Reviewer->>Inngest: send events (pr.review.requested / pr.summary.requested)
    Reviewer-->>Webhook: .then/.catch logs outcome (async)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through code with nimble paws,
Removed a wait, escaped the claws.
Events now carry tidy ids,
A console-log to tell the whys.
Cheer the change — async applause! ✨

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 describes the main change: removing the await keyword from the reviewPullRequest function call in the webhook handler.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0ba6e3b and dbff43d.

📒 Files selected for processing (1)
  • lib/ai/actions/index.ts

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

Copy link
Copy Markdown

@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: 0

🧹 Nitpick comments (1)
app/api/webhooks/github/route.ts (1)

109-122: This fire-and-forget pattern is intentional and correctly handles errors.

The code removes await to prevent GitHub webhook timeouts while the review runs asynchronously in the background. This is consistent with how installation events are handled (lines 42-50, 56-64, etc., which also use inngest.send() without awaiting).

Error handling is more robust than a simple console log: the reviewPullRequest function catches errors and persists them to the database (lib/ai/actions/index.ts, lines 154-166), ensuring no errors are silently lost. The .catch() handler at lines 117-121 provides additional logging.

Consider dispatching the review as an inngest event for consistency.

While the current implementation works correctly, you could improve architectural consistency by handling pull request reviews through inngest (like installation events) rather than calling reviewPullRequest directly from the webhook. This would provide:

  • Unified async job processing across all webhook events
  • Built-in retry logic and observability
  • Guaranteed execution even if the webhook handler crashes

However, this is an optional refactoring; the current approach is functional and correct.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9403207 and 0ba6e3b.

📒 Files selected for processing (2)
  • app/api/webhooks/github/route.ts
  • test.txt
💤 Files with no reviewable changes (1)
  • test.txt

@afuhflynn afuhflynn merged commit 6ec6821 into main Dec 29, 2025
1 check was pending
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