Skip to content

fix(selfhost): wire WEBHOOKS queue binding for the Orb relay receiver#1384

Merged
JSONbored merged 1 commit into
mainfrom
fix/selfhost-wire-webhooks-queue
Jun 25, 2026
Merged

fix(selfhost): wire WEBHOOKS queue binding for the Orb relay receiver#1384
JSONbored merged 1 commit into
mainfrom
fix/selfhost-wire-webhooks-queue

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

The Orb relay receiver (handleOrbRelay) calls c.env.WEBHOOKS.send() to enqueue relayed webhook events onto the dedicated webhook lane — the same path as GitHub's own webhook receiver. server.ts wired JOBS but not WEBHOOKS, so every brokered-relay event failed immediately with enqueue_failed (500), silently eating all forwarded events and preventing any reviews from running on a brokered self-host.

Both JOBS and WEBHOOKS map to the same in-process DurableQueue in self-host mode (all job types share one queue; the consumer handles them regardless of which binding sent them), so the fix is adding WEBHOOKS: backend.queue.binding alongside the existing JOBS alias.

Tests added for all handleOrbRelay branches: missing GitHub headers (400), unconfigured relay/no enrollment secret (404), invalid HMAC signature (401), WEBHOOKS queue failure (500 enqueue_failed), and the success path (202 queued on the WEBHOOKS lane).

Scope

  • Self-host / Orb / broker path
  • New public API or changed API signature
  • DB schema / migration
  • Auth / session / CORS path
  • UI change
  • Docs change

Validation

  • npx vitest run test/unit/webhook.test.ts — 9 tests (4 existing + 5 new), all pass
  • npm run test:ci — exit 0, full gate green

Safety

  • No secrets, tokens, wallets, hotkeys, trust scores, or reward values introduced
  • No auth/CORS changes; no public API surface changed
  • Self-host only; the Cloudflare Worker deployment is unchanged (has real Queue bindings)

The Orb relay receiver (handleOrbRelay) calls c.env.WEBHOOKS.send() to
enqueue incoming relay events onto the dedicated webhook lane — the same
path as GitHub's own webhook receiver. server.ts wired JOBS but not
WEBHOOKS, so every relayed event failed with enqueue_failed and a 500.

Both lanes share the in-process DurableQueue in self-host mode (the queue
consumer processes all job types regardless of which binding sent them),
so the fix is a one-line alias.

Tests added for handleOrbRelay covering every branch: missing headers
(400), unconfigured relay (404), invalid HMAC (401), queue failure (500),
and the success path (202 queued on the WEBHOOKS lane).
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 25, 2026
@superagent-security

Copy link
Copy Markdown

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

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.36%. Comparing base (47593c4) to head (5474a5a).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1384   +/-   ##
=======================================
  Coverage   95.36%   95.36%           
=======================================
  Files         191      191           
  Lines       20714    20714           
  Branches     7489     7489           
=======================================
  Hits        19753    19753           
  Misses        380      380           
  Partials      581      581           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored JSONbored merged commit acd1535 into main Jun 25, 2026
19 checks passed
@JSONbored JSONbored deleted the fix/selfhost-wire-webhooks-queue branch June 25, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant