Skip to content

fix(dag): mark wake reported at admit time (restart-safe wake delivery) #321

Description

@LeXwDeX

Incident (2026-08-17, same session as #320)

After the terminal wake of dag_fe5ff13ada6fUONA2rH3Pypdf4 was injected at 17:25:29, the parent turn ran ~10 min (authoring the wave-2 replan spec) when the process restarted at 17:35:22. Because wake_reported is persisted only AFTER yield* delivered.value (the whole wake-driven turn completes) — while the transcript part is written at admit time — the mark never landed. The new process's startup sweep re-injected the byte-identical 4391-char wake (diff-verified), because the in-memory dedup map deliveredWakeSummaries does not survive restarts. This is the hole the GOAL-FP-01-14 comment in loop.ts admits.

Design (grill-settled)

  • Semantics change: admit success = delivered. markWakeBatchReported moves to right after admitIfIdle succeeds (durable prompt queued + synthetic part persisted), before awaiting the wake turn.
  • Drop "turn failure redelivers": the synthetic part stays in transcript history anyway; redelivery added duplicate injections, never information.
  • Restart window shrinks from minutes (turn duration) to microseconds (admit→mark).
  • Keep in-memory dedup map for same-process mark retries; unregister of terminal workflows moves with the mark.
  • Update stale GOAL-FP-01-14 rationale comments; adapt any existing dag-wake-integration test that asserts turn-failure redelivery (semantic flip is intentional).

Acceptance

  • Regression test: wake admitted → turn fails/interrupted → wake_reported=1, no re-injection on next trigger; simulated restart (fresh loop instance over same store) does not re-deliver
  • test/dag/ full suite green, bun typecheck clean

Status

Worktree /private/tmp/oc-dag-wake-durability, branch fix/wake-durability (based on dev @16f9add17). Pending: red test, implementation, regression, commit. PR title: fix(dag): mark wake reported at admit time.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions