Skip to content

fix(reliability): suppress redelivery of already-processed webhook events (#789) - #818

Merged
JSONbored merged 1 commit into
mainfrom
fix/gate-webhook-reliability
Jun 17, 2026
Merged

fix(reliability): suppress redelivery of already-processed webhook events (#789)#818
JSONbored merged 1 commit into
mainfrom
fix/gate-webhook-reliability

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

On success the queue overwrites a webhook event's payloadHash with a processed sentinel, so a GitHub redelivery (same delivery id, real payload hash) failed the hash-only dedup at webhook.ts:40 and reprocessed — re-firing side effects. Gate/check ops are idempotent (PATCH), but recordGithubProductUsage and audit events double-counted and the advisory re-posted.

Fix: dedup now also suppresses any non-error event already in the processed state, while still letting error rows through so a failed enqueue/processing can retry. Surgical: 1 source file, 5 lines.

Test: seeds a processed event, then redelivers with the real payload → asserts 202 duplicate and that JOBS.send is not called. 3 webhook tests pass; changed lines covered.

Closes #789

…ents

On success the queue overwrites a webhook event's payloadHash with a "processed"
sentinel, so a GitHub redelivery (same delivery id, real payload hash) failed the
hash-only dedup and reprocessed the event — re-firing its side effects. Gate/check
ops are idempotent (PATCH), but recordGithubProductUsage and audit events
double-counted and the advisory re-posted.

Dedup now also suppresses any non-"error" event already in the "processed" state,
while still letting "error" rows through so a failed enqueue/processing can retry.

Closes #789
@dosubot dosubot Bot added the size:XS label Jun 17, 2026
@ghost

ghost commented Jun 17, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #818 is no longer open. No action.

💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

@ghost ghost added the gittensory:reviewed label Jun 17, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.77%. Comparing base (7d7d26d) to head (1c66ce3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #818   +/-   ##
=======================================
  Coverage   96.77%   96.77%           
=======================================
  Files          97       97           
  Lines       14000    14000           
  Branches     5098     5098           
=======================================
  Hits        13548    13548           
  Misses         86       86           
  Partials      366      366           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ghost

ghost commented Jun 17, 2026

Copy link
Copy Markdown

gittensory · advisory review

Reviewed 2 changed file(s) — two independent AI reviewers.

Changed files: src/github/webhook.ts, test/unit/webhook.test.ts

Suggested action:Safe to merge — both reviewers found no blocking issues.

Reviewer A · gpt-oss-120b — recommends ✅ merge
The PR updates webhook deduplication to correctly suppress redelivery of already‑processed events by checking the event status, and adds a unit test confirming the behavior. The change is small, well‑scoped, and includes test coverage.

Suggestions

  • Add a test case verifying that an event with status "error" is still processed (i.e., not suppressed).
  • Consider documenting the "processed" sentinel value in the repository README or code comments for future maintainers.
  • If new webhook statuses are introduced later, review this deduplication logic to ensure it still behaves as intended.

Worth double-checking

  • Future changes to status values could affect the duplicate‑suppression logic; keep the condition up‑to‑date.
  • Ensure that recordWebhookEvent correctly sets the status and payloadHash fields as expected.

Reviewer B · nemotron-3-120b-a12b — recommends ✅ merge
The PR modifies webhook deduplication logic to suppress redeliveries of already-processed events by checking for 'processed' status in addition to payload hash matching. The change correctly handles the case where successful processing overwrites payloadHash with a 'processed' sentinel. A new test verifies this behavior. The fix is targeted, well-tested, and aligns with the reliability goal.

Worth double-checking

  • Ensure the 'processed' sentinel value cannot collide with a legitimate payloadHash (though SHA-256 output makes this astronomically unlikely).
  • Confirm that error-status events remain unsuppressed for retries (explicitly retained in the condition).

@JSONbored
JSONbored merged commit 3d35c86 into main Jun 17, 2026
19 checks passed
@JSONbored
JSONbored deleted the fix/gate-webhook-reliability branch June 17, 2026 09:05
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.

[Bug]: webhook redelivery re-runs non-idempotent side effects (P2)

1 participant