Skip to content

Deduplicate concurrent GitHub webhook retries - #4

Open
wellkilo wants to merge 1 commit into
repopilot/demo-webhook-replay-baselinefrom
fix/idempotent-webhook-replay
Open

wellkilo wants to merge 1 commit into
repopilot/demo-webhook-replay-baselinefrom
fix/idempotent-webhook-replay

Conversation

@wellkilo

@wellkilo wellkilo commented Aug 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • make maintenance-task creation idempotent per GitHub delivery ID
  • share one in-flight creation across concurrent webhook retries
  • dispatch only the newly created task
  • preserve independent processing for different delivery IDs
  • document the webhook replay scenario and repair contract

Root cause

The processor performed find and save as separate async operations. Two concurrent requests could both observe an empty store, create different task IDs, and dispatch twice.

Repair

DeliveryTaskStore.getOrCreate now owns the entire create-or-reuse decision. It caches the in-flight Promise for each delivery ID, so concurrent retries await the same task. Completed tasks are retained for sequential retries; the in-flight entry is always cleared after completion.

Verification

npm ci
npm run typecheck
npm test
npm run build

Validated locally:

  • 7 tests passed
  • concurrent same-delivery requests return the same task ID
  • exactly one result is newly created
  • dispatch runs once
  • sequential retry reuses the task
  • different delivery IDs remain independent

Relates to #3

Created as the RepoPilot Issue-to-PR demo under the pull_request_only policy. This PR must remain open for human review and must not be auto-merged.

Share one in-flight task creation per GitHub delivery ID so concurrent retries return the same maintenance task and dispatch exactly once. Add sequential retry and independent-delivery regression coverage.
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