Skip to content

Conversation

@TooAngel
Copy link
Owner

Summary

  • Fixed bug where activity log entries like "Pull request opened" appeared twice
  • Root cause: GitHub was retrying webhooks due to 10-second timeout

Root Cause

The webhook handler was awaiting all processing before responding:

result = await handlePullRequestWebhook(data);  // API calls, DB ops...
res.json(result);  // Response sent AFTER processing

When processing took >10 seconds, GitHub would timeout and retry, causing duplicates.

Evidence from PR #318:

  • 11:35:47 - Pull request opened
  • 11:35:49 - Pull request opened (2 seconds later = GitHub retry)

Fix

Respond immediately, process asynchronously:

res.json({ info: 'Webhook received, processing asynchronously' });

(async () => {
  await handlePullRequestWebhook(data);
})();

Test plan

  • All 109 unit tests pass
  • Manual verification: open a PR and check activity log doesn't have duplicates

GitHub has a 10-second timeout for webhook responses. When processing
took longer (due to API calls, database ops, etc.), GitHub would retry
the webhook, causing duplicate activity log entries like "Pull request
opened" appearing twice.

Now the webhook endpoint responds immediately with 200 OK and processes
the webhook asynchronously in the background. This prevents timeouts
and eliminates duplicate webhook deliveries.
@worlddriven
Copy link
Contributor

worlddriven bot commented Nov 30, 2025

🤖 Worlddriven Status

📊 Live Status Dashboard

🗓️ Merge Date: 2025-12-03 at 23:19:41 UTC (today)
📅 Started: 2025-12-02 at 03:52:07 UTC
Speed Factor: 0.18 (82% faster due to reviews)
Positive votes: 303/370 contribution weight (coefficient: 0.82)
📈 Base Merge Time: 10 days → Current: 2 days

🎯 Want to influence when this merges?

Your review matters! As a contributor to this project, your voice helps determine the merge timeline.

How to review:

  1. Check the changes
    Files changed

  2. Leave your review
    Review changes

Your options:

  • ✅ Agree & Speed Up: Approve Approving makes this merge faster
  • ❌ Disagree & Slow Down: Request changes Requesting changes delays the merge

💡 Pro tip: The more contributors who agree, the faster this gets merged!

📊 View detailed stats on the dashboard

📋 Recent Activity

2025-11-30, 11:49:41 - Pull request opened
2025-11-30, 11:49:42 - Pull request opened
2025-12-03, 23:51:54 - Pull request merged by worlddriven ✅


This comment is automatically updated by worlddriven

@worlddriven worlddriven bot merged commit 21c1765 into master Dec 3, 2025
2 checks passed
@worlddriven worlddriven bot deleted the fix/webhook-idempotency branch December 3, 2025 23:51
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