Skip to content

fix(orb): handleOrbWebhook's trailing recordOrbWebhookEvent write is unguarded, unlike the write two lines above it #8883

Description

@JSONbored

⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.

Context

src/orb/webhook.ts:73-92: lines 73-83 wrap upsertOrbInstallation + recordOrbPrOutcome in try/catch specifically to turn a DB-write failure into a clean 500 {error:"processing_failed"} plus a logged orb_webhook_processing_failed event (tested at test/integration/orb-webhook.test.ts:45). The very next DB write, await recordOrbWebhookEvent(c.env, { ...eventMeta, status: "received" }) at line 85, has no such guard -- if it throws, the response at line 92 is never reached, the delivery is unrecorded (so a GitHub redelivery re-runs the already-successful upsert/outcome recording with zero visibility into why), and no structured log is emitted for this specific failure mode.

Requirements

Wrap the line-85 write the same way the block above it is wrapped (or fold it into the same try/catch), with its own structured error log distinguishing "processing succeeded but the event row failed to record" from the earlier failure mode.

Deliverables

  • The recordOrbWebhookEvent write at line 85 is guarded by try/catch, with a distinct structured log message for this specific failure mode
  • A test in test/integration/orb-webhook.test.ts exercising this write throwing, asserting a clean response and the distinct log message (not an unhandled rejection)

All of the above Deliverables are required in the same PR unless the deliverable text itself states otherwise.

Test Coverage Requirements

src/** -- 99%+ patch coverage, branch-counted, on the new catch path.

Expected Outcome

A DB-write failure on the trailing event-recording call degrades to a clean, distinctly-logged response instead of an uncaught exception hiding a redelivery-visibility gap.

Links & Resources

  • src/orb/webhook.ts:73-92
  • test/integration/orb-webhook.test.ts:45

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions