Repository navigation
Description
Summary
The host-to-server event channel is at-least-once, but daemon ingestion is not idempotent for turn/started. A committed batch whose acknowledgement is lost can be retried with the same provider turn ID, persist a duplicate start, and make timeline projection throw; the public timeline route returns 500 even though the thread data remains stored.
Implementation: PR #1560
Versions and environment
- Reproduced on parent commit
a83c12946790724383c84b665ac899b9d3bef601 - Boundary: host daemon event delivery → server ingestion → timeline projection
- Reproduction uses in-memory SQLite and synthetic persisted events
Steps to reproduce
- Insert two
turn/startedevents for the same(threadId, turnId), simulating a daemon retry after an ambiguous 502/504 response. - Request that thread's public timeline.
- Observe the unfixed route return 500 because projection sees two starts for one provider turn.
The exact red fixture and command are documented in PR #1560.
Expected vs actual
Expected: re-delivery is idempotent and previously persisted duplicate histories remain readable.
Actual: a duplicate receives a fresh event ID and sequence; projection throws. The regression fails on the parent with AssertionError: expected 500 to be 200.
Evidence
- Ingestion now resolves stored turn identities and skips duplicate starts in events.ts.
- Legacy projection compatibility and route-level regressions are included in PR #1560.
What you ruled out
- Not distinct provider turns: the incident repeated stable turn and item IDs at later server sequences.
- Not general exactly-once delivery: the required boundary is semantic idempotency for
turn/started. - Not Codex thread shows
idle(no spinner) while actively running commands #1646: that issue is missing/late starts during continuation, not duplicate starts from delivery replay. - No exact open or closed issue matched the invariant, PR URL, originating thread, or failure output.
Suggested priority and effort
High priority, medium effort: affected threads become unreadable; the fix must protect new ingestion and tolerate persisted duplicates.
Originating implementation thread: thr_tq4bctwps7
AGENT GENERATED: by GPT-5.6-Sol
Activity
Skip replayed turn/started events at daemon ingestion (get-bb#2126)