Skip to content

fix(core): drop stale dag node terminal events via db status cross-check - #133

Merged
LeXwDeX merged 1 commit into
devfrom
fix/dag-stale-events
Jul 29, 2026
Merged

fix(core): drop stale dag node terminal events via db status cross-check#133
LeXwDeX merged 1 commit into
devfrom
fix/dag-stale-events

Conversation

@LeXwDeX

@LeXwDeX LeXwDeX commented Jul 29, 2026

Copy link
Copy Markdown
Owner

What

Generation arbitration for DAG node terminal events, using the DB row as source of truth (projection is transactional with publish):

  • loop.ts: NodeCompleted/NodeSkipped handlers now cross-check the node row still matches the event's terminal status before deleting fibers or settling runtime state — mirroring and extending the NodeFailed guard. NodeFailed additionally requires status === "failed" before aborting the child, so a stale failure event after NodeRestarted/replan cannot kill the new generation's fiber.
  • capture.ts: validateAgainstSchema now enforces const/enum via structural deepEqual (JSON.stringify is key-order-sensitive).

Tests

  • New test/dag/dag-replan-stale-nodefailed.test.ts covering the stale-event drop paths
  • Extended dag-structured-output and dag-wake-integration suites
  • Full packages/opencode/test/dag/: 261 pass / 0 fail locally

Loop handlers for NodeCompleted/NodeSkipped/NodeFailed now confirm the node row still reflects the event's terminal status before touching fibers or runtime state, so events from a previous generation (after NodeRestarted/replan) are dropped. Schema capture validation additionally enforces const/enum via structural equality.
@LeXwDeX
LeXwDeX merged commit e95479f into dev Jul 29, 2026
4 checks passed
@LeXwDeX
LeXwDeX deleted the fix/dag-stale-events branch July 29, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant