Skip to content

fix(dag): host-level supervision sweep settles nodes orphaned by instance teardown - #339

Merged
LeXwDeX merged 45 commits into
mainfrom
dev
Aug 18, 2026
Merged

fix(dag): host-level supervision sweep settles nodes orphaned by instance teardown#339
LeXwDeX merged 45 commits into
mainfrom
dev

Conversation

@LeXwDeX

Copy link
Copy Markdown
Owner

Incident (2026-08-18, dag_fe5feabfcae607fqVdRh47lN1B)

A per-directory instance teardown mid-run silently reaped every fiber in its scope — DagLoop subscriptions, the spawn fiber, AND the deadline watcher — while the durable node row stayed running. In a live host nothing re-arms supervision, so sg4-integrate rotted in running for 7.5h+ past its deadline with escalation_pending=0, timeout_extensions=0. Recovery can settle such rows, but only re-init/crash triggers it.

Fix (via #338, merged to dev; dev CI green)

New host-level service DagSupervisionSweep (src/dag/runtime/supervision-sweep.ts), wired into AppLayer:

  • 60s repeating sweep fiber forked into the LAYER scope at construction — survives per-instance teardown, never depends on ambient InstanceRef.
  • Flat-streak detection over timeout_extensions with a per-node window frozenTicksNeeded(escalateIntervalMs) = ceil(max(interval,1s)/60s)+1, cadence read defensively from the persisted workflow config (degrade → DEFAULT 10-min window). A live watcher at ANY configured timeout always moves the counter inside the window.
  • Settle = cause-recovered best-effort child cancel + nodeFailed(..., "timeout") under the durable terminal-status guard (cross-host double settles collapse to one). All recovery sites propagate interrupts; failed settles retry next tick.

Tests

test/dag/dag-node-supervision.test.ts: healthy control, stream-hang (incident shape), dispose-instance (mechanism + sweep fallback), cancel-defect (production InstanceRef die never blocks the settle; mutation-verified), freeze window (live watcher never swept at production cadence relationship), pure unit tests for cadence derivation/degrade and window boundaries. 9/9 pass locally and in dev CI.

Reviewed through a 6-round fixed-point loop (R1–R6); R5/R6 consecutive PASS with zero findings.

fix(memory): extend background-maintenance lock discipline to the periodic prepare path (issue #324)
…, neutral pause msg, interrupt suppression, stronger no-op test)
…kpoint gating at replan/extend (DAG-01/DAG-02)
fix(dag): resolve audit defects DAG-01..04 (fixed-point loop converged)
fix(goal): resolve audit defects GOAL-01..04 (fixed-point loop converged)
fix(memory): matcher calls outside the identity fence, exit-safe in-flight coalescing (acceptance leftovers)
fix(dag): adversarial verification clause on reporting checkpoints (issue #323)
…ance teardown (production incident 2026-08-18)
fix(dag): host-level supervision sweep settles nodes orphaned by instance teardown
@LeXwDeX
LeXwDeX merged commit 31bd2d4 into mainAug 18, 2026
15 checks passed
Sign up for freeto 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

@LeXwDeX