Repository navigation
Description
Finding (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's read-back endpoint. Codex's P2 finding: the pagination cursor is the last returned event's timestamp alone, so events sharing that timestamp are skipped. With three events at the same ts and limit=2, the third event is unreachable through pagination, even though the query already orders by (ts, event_id).
- Source PR: feat(pm-stack): decision-set event pipeline — Turso sync + Cloudflare Worker/D1/DO (#9335) #9341
- Review comment: feat(pm-stack): decision-set event pipeline — Turso sync + Cloudflare Worker/D1/DO (#9335) #9341 (comment)
- Reviewer:
chatgpt-codex-connector[bot], 2026-11-13T05:34:08Z (P2) - Flagged location:
pm-stack/decision-events-worker/src/index.ts:195
"When a page ends within a group of events sharing the same timestamp, requesting the next page with
afterequal to the last returned timestamp skips all remaining events in that group. For example, three events with identicaltsvalues andlimit=2make the third event unreachable through pagination. The ordering already uses(ts, event_id); expose and apply that same composite cursor so bounded read-back does not omit events."
No-response evidence
- The review thread contains only the Codex comment — no replies (verified 2026-11-14 via the PR comments API and a GraphQL
reviewThreadsread:isResolved=false, 1 comment). - PR feat(pm-stack): decision-set event pipeline — Turso sync + Cloudflare Worker/D1/DO (#9335) #9341's only commit after the comment is
66940fb15f(2026-11-13T05:40:26Z), a merge oforigin/maininto the branch — it does not touch the flagged logic. The PR merged at 2026-11-13T05:45:31Z (merge commitaad1d3602a) with the finding unaddressed; the only later main commit touching these files is a treefmt style pass (d451641c31). - Dedupe: open/closed issue searches by comment id, file path, and keywords (fan-out, pagination cursor, outbox-dir, webhook acknowledgement) found no issue covering this finding; parent issue pm-stack decision sets v2: rich questions, event log, submit API + activity webhook/hook #9335 is closed and does not track it.
Still-live evidence (verified 2026-11-14 on current main)
pm-stack/decision-events-worker/src/index.ts:189-197(handleGetEvents):afteris read as a bare timestamp and the query is... WHERE set_id = ? AND ts > ? ORDER BY ts, event_id LIMIT ?— there is noevent_idcomponent to the cursor, so a page boundary inside a same-tsgroup drops the rest of the group.
Acceptance criteria
- Read-back pagination uses a composite
(ts, event_id)cursor (exposed and applied), so paging through a set returns every event exactly once, including groups sharing a timestamp. - A regression test pages through at least three events with identical
tsat a small limit and receives all of them. - Or: a documented decision on this issue that this omission is accepted, with the reasoning recorded.
Activity
dezren39 commentedon Nov 14, 2026
🤖 Agent note · filed
dezren39 commentedon 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 whilerepo-worker-any-aposts progress markers; after 30 minutes of silence any other worker may pick this up.)88 remaining items
dezren39 commentedon Nov 14, 2026
Agent note — picked up (lane code-d, task 16159)
pm-stack/decision-events-worker/src/index.tshandleGetEventsreadsafteras a bare timestamp and queriests > ?while ordering byts, event_id— a page boundary inside a same-ts group makes the rest of the group unreachable.(ts, event_id)cursor, exposed in the response and applied on the next request) plus a regression test paging a same-timestamp group, per the issue acceptance criteria. Laptop route is restored this shift, so the fix is not being split into a follow-on packet.fix(pm-stack): composite (ts, event_id) cursor for decision-events re…
dezren39 commentedon Nov 14, 2026
Agent note — done (lane code-d, task 16159)
fixed_merged. The triage finding was re-verified live on main and the fix was implemented in this same claim (laptop route restored, so no follow-on split).(ts, event_id)cursor: the response carriesnextAfter(<ts>|<eventId>of the page's last event) andafterin that form resumes with(ts > ? OR (ts = ? AND event_id > ?)). Bare-tsafterkeeps its legacy meaning; a malformed cursor is a 400. Cursor helpers live insrc/events.ts(encodeEventsCursor/parseEventsCursor); README documents the contract.test/pagination.test.tsruns the real handler + real SQL against in-memory SQLite (D1 stand-in) — paging a same-timestamp group at limit=2 returns every event exactly once in(ts, event_id)order; verified failing on the original code (2 of 3 fail, legacy test passes).bun test: 14 pass / 0 fail.bunx tsc --noEmit: pass.6f08faad14df12c51d30e97f7fde6bf46751dfae; this issue auto-closed by the merge. Claim labels removed at completion.dezren39 commentedon Nov 14, 2026
Agent note — already done (lane code-d, task 16217)
already_done. Task 16217 is the auto follow-on (small_fix) of triage task 16159 for this issue; the fix was implemented and merged inside the task 16159 claim itself, so no duplicate work was done here.6f08faad14df12c51d30e97f7fde6bf46751dfae, 2026-11-14T03:49:17Z); currentmaincarries the composite cursor (pm-stack/decision-events-worker/src/index.ts:(ts > ? OR (ts = ? AND event_id > ?))plus thenextAfterresponse field).