fix(orb): guard the trailing webhook-event record write in handleOrbWebhook - #8934
Conversation
…ebhook
The status:"received" recordOrbWebhookEvent write ran outside the try/catch that
wraps the upsert/outcome writes above it. If it threw, execution never reached the
202 response, the delivery went unrecorded (so a GitHub redelivery re-ran the
already-successful upsert/outcome processing) and no structured log was emitted for
this specific failure mode.
Wrap the trailing write in its own try/catch with a distinct
orb_webhook_event_record_failed error log and a clean 500 { error:
"event_record_failed" }, so GitHub redelivers and retries the row -- mirroring the
processing-failed handling above while keeping the two failure modes distinguishable.
Closes JSONbored#8883
|
🚨 Contributor flagged. Click here for more info: Superagent Dashboard |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-26 14:16:15 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. Decision record
🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8934 +/- ##
==========================================
+ Coverage 90.56% 90.58% +0.02%
==========================================
Files 96 97 +1
Lines 22490 22554 +64
Branches 3884 3903 +19
==========================================
+ Hits 20367 20431 +64
Misses 1945 1945
Partials 178 178
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Held for manual review: the gate and required CI are green, but GitHub reports this pull request's mergeable state as |
What & why
Closes #8883.
src/orb/webhook.ts'shandleOrbWebhookwraps theupsertOrbInstallation+recordOrbPrOutcomewrites in a try/catch that turns a DB-write failure into a clean
500 {error:"processing_failed"}plus a logged
orb_webhook_processing_failedevent. The very next DB write —recordOrbWebhookEvent(..., status:"received")— had no such guard. If it threw, the202response below was never reached, the delivery went unrecorded (so a GitHub redelivery re-ran the
already-successful upsert/outcome processing, with zero visibility into why), and no structured log
was emitted for this specific mode.
Change
Wrap the trailing write in its own try/catch with a distinct
orb_webhook_event_record_failederror log and a clean
500 {error:"event_record_failed"}, so GitHub redelivers and the row isretried — mirroring the processing-failed handling above while keeping the two modes distinguishable
(processing succeeded vs the event row failed to record).
Validation
test/integration/orb-webhook.test.ts: throws only on the trailingorb_webhook_eventsINSERT (upsert/outcome succeed, dedup read succeeds), asserts a clean500 {error:"event_record_failed"}, the distinctorb_webhook_event_record_failedlog with theidentifying fields, and that
orb_webhook_processing_failedis not logged.202).