fix(selfhost): isolate per-event enqueue failures in the Orb relay drain loop - #3842
Conversation
…ain loop (#3813) drainOrbRelayWithMonitor called args.enqueue() with no try/catch around it. enqueueWebhookByEnv swallows its own anticipated failures and returns a string result, but a D1/Postgres write failure inside one of its two unwrapped recordWebhookEvent calls throws uncaught -- aborting the entire remaining batch for that drain tick. Every event after the failing one was silently never attempted. Wrap the enqueue call per event: a throw is now treated exactly like the existing non-throwing "enqueue_failed" result -- logged, counted, and NOT acked (so the relay redelivers it), with the loop continuing to the next event instead of aborting the batch.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3842 +/- ##
=======================================
Coverage 93.41% 93.41%
=======================================
Files 326 326
Lines 32855 32860 +5
Branches 12035 12036 +1
=======================================
+ Hits 30691 30696 +5
Misses 1530 1530
Partials 634 634
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-06 14:51:12 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 5 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 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.
|
Summary
drainOrbRelayWithMonitor's per-event loop calledargs.enqueue(...)with no try/catch.enqueueWebhookByEnvswallows its own anticipated failures (missing queue binding, queue send failure) and returns a string result — but two of itsrecordWebhookEventcalls are not wrapped in try/catch, so a D1/Postgres write failure there throws uncaught out of the loop, aborting the ENTIRE remaining batch for that drain tick. Every event still in the batch after the failing one was silently never attempted."enqueue_failed"result — logged (neworb_relay_enqueue_threwstructured error, Sentry-visible) and counted (gittensory_orb_webhook_total{result="enqueue_failed"}), not acked (so the relay redelivers it next drain), and the loop continues to the next event instead of aborting.Closes #3813.
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally;codecov/patchrequires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateSafety
UI Evidencesection below. (N/A — no visible UI change.)