Skip to content

pm-stack: decision-event sync acks events the Worker rejected — validator mismatch silently drops events (PR #9341 Codex P2) #9613

Closed

Description

@dezren39

Finding (from PR review)

PR #9341 (merged, feat(pm-stack): decision-set event pipeline — Turso sync + Cloudflare Worker/D1/DO (#9335)) adds the decision-event sync leg. Codex's P2 finding: the sync client acknowledges every pending event after a webhook batch, without checking how many the Worker actually accepted — and the two sides validate timestamps differently, so a real event shape crosses the gap: an outbox event with ts: "2026-11-12" passes the aggregator's isIsoDate validation but is rejected by the Worker's timestamp validator, which requires a T. The Worker returns HTTP 200 with the event in its per-event errors; the client marks it acknowledged anyway, so it is never stored in D1 and never retried — silent event loss.

"The Worker returns HTTP 200 even when individual events fail validation, but this client checks only inserted and then syncDecisionEvents marks every pending event acknowledged. This occurs with the current implementations: an outbox event with ts: \"2026-11-12\" passes the aggregator's isIsoDate validation but is rejected by the Worker's timestamp validator, which requires T. The event is consequently never stored in D1 and never retried. Check the response's acceptance count and per-event errors before advancing acknowledgment state, and align the two validators."

No-response evidence

Still-live evidence (verified 2026-11-14 on current main)

  • pm-stack/aggregator/src/decision-events-sync.ts:344-347 (postDecisionEventsWebhook): on HTTP 200 it checks only that out.inserted is a number — accepted and errors are never compared against the batch.
  • pm-stack/aggregator/src/decision-events-sync.ts:462 (syncDecisionEvents): markAcked(opts.state, leg, pending) acknowledges all pending events for the leg, regardless of per-event rejection.
  • Validator mismatch intact: aggregator validateDecisionEvent (line 164) uses isIsoDate from src/validate.ts, which accepts a date-only string; the Worker's isIsoTimestamp in pm-stack/decision-events-worker/src/events.ts returns false when the value contains no T.

Acceptance criteria

  • The webhook leg advances acknowledgment only for events the Worker accepted (compare accepted/errors, or ack per-event), and rejected events stay pending with the rejection surfaced in the leg report.
  • The aggregator and Worker timestamp validators accept the same shapes (or the mismatch is otherwise closed), with a test using a date-only ts event.
  • Or: a documented decision on this issue that this loss mode is accepted, with the reasoning recorded.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/normalOrdinary priority (the default)
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    on Nov 14, 2026
  2. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  3. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    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.)

  4. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    and removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 14, 2026
  5. 97 remaining items

  6. added and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 14, 2026
  7. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Triage complete (task 16158): confirmed live on origin/main (d4f6a03c):

    • pm-stack/aggregator/src/decision-events-sync.ts:344-347 only checks typeof out.inserted !== "number" and :462 unconditionally calls markAcked(opts.state, leg, pending).
    • Enqueued scoped small_fix task 16162 (repo-health:v1:fix:developing-today/code:issue:9613).
  8. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 14, 2026
  9. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Picked up task 16162 (lane code-j, openchamber-scheduled-lane) to fix #9613.

  10. dezren39 commented on Nov 14, 2026

    @dezren39
    MemberAuthor

    Opened PR #9633 (queue/16162-9613-decision-events-sync) to fix #9613. Targeted tests pass (bun test test/decision-events.test.ts: 15 pass, 0 fail).

  11. added a commit that references this issue on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/mMedium: expected under 1 day of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/pr-comment-reviewFiled by the pr-comment-review jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions