GeezerVison is showing github.com — pm-stack: decision-events Worker loses Durable Object fan-out when ingest fails after the D1 commit (PR #9341 Codex P1) · Issue #9612 · developing-today/code
pm-stack: decision-events Worker loses Durable Object fan-out when ingest fails after the D1 commit (PR #9341 Codex P1) #9612DescriptionFinding (from PR review)
PR #9341 (merged, feat(pm-stack): decision-set event pipeline — Turso sync + Cloudflare Worker/D1/DO (#9335)) adds the decision-events Worker. Codex's P1 finding: pending Durable Object fan-out is lost permanently when ingest fails after the D1 batch commits. The Worker fans out only events whose D1 INSERT OR IGNORE reported changes; if the Durable Object ingest then fails (non-OK response), the handler still returns HTTP 200, the sync client acknowledges the events, and on any retry the D1 inserts report zero changes — so the events are never fanned out to subscribers or the per-set coordination state.
"If the Durable Object ingest fails after the D1 batch commits, these events can never reach the object on retry: their next inserts report zero changes, so insertedEvents excludes them permanently. A non-OK ingest response is also converted into an HTTP 200 webhook response, causing the sync client to acknowledge the events despite the failed fan-out. Persist pending fan-out separately and retry it, with event-ID deduplication at the Durable Object, so transient failures do not permanently lose subscriber notifications and coordination state."
No-response evidence
Still-live evidence (verified 2026-11-14 on current main)
pm-stack/decision-events-worker/src/index.ts:160-186: the D1 batch runs first; insertedEvents is built only from rows with meta.changes > 0 (lines 161-167); the fan-out loop (line 170) iterates only insertedEvents; a non-OK ingest is recorded as { error: ... } in the fanout map (line 177) and the handler still returns Response.json({...}) with HTTP 200 (lines 180-186). A retry therefore excludes the already-stored events from fan-out forever.
- The Durable Object
/ingest handler (lines 91-96) increments state.fannedOut and overwrites last-event fields for every event it receives, with no event-ID deduplication — so a retry mechanism also needs the dedup the reviewer asked for.
Acceptance criteria
- A failed Durable Object ingest no longer loses fan-out: pending fan-out is persisted/retried (or the webhook returns a non-200 the sync client will not acknowledge), and the Durable Object deduplicates by event ID.
- A regression test covers: D1 commit succeeds, DO ingest fails, retry delivers the events exactly once.
- Or: a documented decision on this issue that this loss mode is accepted, with the reasoning recorded.
Activitydezren39 commented on Nov 14, 2026 dezren39 commented on Nov 14, 2026
Picked up by repo-worker-any-a — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-any-a posts progress markers; after 30 minutes of silence any other worker may pick this up.) dezren39 commented on Nov 14, 2026 agent-note:v1
worker: repo-worker-code
lane: code-h
task_id: 16157
state: claimed
note: Picked up small_fix for #9612. Creating worktree and inspecting pm-stack/decision-events-worker. dezren39 commented on Nov 14, 2026 agent-note:v1
worker: repo-worker-code
lane: code-h
task_id: 16157
state: done
note: Opened PR #9624 (#9624) fixing DO fan-out loss on ingest failure and adding eventId deduplication. bun test: 8 pass, 0 fail. dezren39 commented on Nov 17, 2026
state: already_done (re-triage)
lane: any-b, worker: repo-worker-code, task 19057
Re-triage of #9612 (2026-11-17): already fixed and closed. Lane code-h verified the defect live on origin/main on 2026-11-14 (tasks 16156/16157) and landed PR #9624 — DO fan-out no longer lost when /ingest fails after the D1 commit, plus eventId deduplication in the Durable Object (bun test: 8 pass, 0 fail, per the closing note). PR merge state re-verified fresh this shift and recorded in the triage result. No further work.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|