Problem
enqueueGithubWebhookSync executes full discovery + materialization synchronously inside the webhook HTTP handler (ee/apps/den-api/src/routes/webhooks/github.ts:84 → store.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:
- Webhook ingress persists the event as
queued and returns 202 immediately (no GitHub API calls in the request path).
- A background worker claims events with per-target serialization (ordering), jittered exponential backoff retries, and a dead-letter/
failed terminal state after N attempts.
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).
Problem
enqueueGithubWebhookSyncexecutes full discovery + materialization synchronously inside the webhook HTTP handler (ee/apps/den-api/src/routes/webhooks/github.ts:84→store.tsauto-import loop). Consequences:ConnectorSyncEventTablehas aqueuedstatus, but nothing consumes it:retryConnectorSyncEvent(store.ts) flips a row back toqueuedforever — the UI Retry button is a no-op.failedand that revision is never re-attempted.Fix
Ack-then-process:
queuedand returns 202 immediately (no GitHub API calls in the request path).failedterminal state after N attempts.retryConnectorSyncEventre-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-githubwitness 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).