Skip to content

GitHub webhook sync runs inline in the delivery request; queued/retried sync events are never processed #3530

Description

@benjaminshafii

Problem

enqueueGithubWebhookSync executes full discovery + materialization synchronously inside the webhook HTTP handler (ee/apps/den-api/src/routes/webhooks/github.ts:84store.ts auto-import loop). Consequences:

  • GitHub allows ~10s per delivery and GitHub Apps do not auto-retry failed deliveries — a slow tree/contents fetch means the push is silently lost.
  • ConnectorSyncEventTable has a queued status, but nothing consumes it: retryConnectorSyncEvent (store.ts) flips a row back to queued forever — the UI Retry button is a no-op.
  • Transient GitHub failures mark the event failed and that revision is never re-attempted.
  • Concurrent deliveries for back-to-back pushes can process out of order (the per-file blob-sha guard prevents redundant fetches, not stale-overwrites-fresh).

Fix

Ack-then-process:

  1. Webhook ingress persists the event as queued and returns 202 immediately (no GitHub API calls in the request path).
  2. A background worker claims events with per-target serialization (ordering), jittered exponential backoff retries, and a dead-letter/failed terminal state after N attempts.
  3. retryConnectorSyncEvent re-enqueues into the same worker (becomes real).

The automations subsystem already implements this claim/retry queue shape (ee/apps/den-api/src/automations/repository.ts:328-641) — reuse the pattern/infra.

Deterministically testable with the mock-github witness from #3529 (inject latency/429s, assert ingress acks before any provider call, assert retry then completion).

Part of the GitHub sync reliability plan (see tracking issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions