fix(dag): host-level supervision sweep settles nodes orphaned by instance teardown - #338
Merged
Conversation
…ance teardown (production incident 2026-08-18)
…nce-aware freeze window (review R1)
…-host comment (review R5)
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 18, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, sosg4-integraterotted inrunningfor 7.5h+ past its deadline withescalation_pending=0,timeout_extensions=0(thesg4-commandssiblingverdict_failwas correct engine behavior). Recovery can settle such rows, but only re-init/crash triggers it.Fix
New host-level service
DagSupervisionSweep(src/dag/runtime/supervision-sweep.ts), wired into AppLayer:timeout_extensionsunchanged forfrozenTicksNeeded(escalateIntervalMs) = ceil(max(interval,1s)/60s)+1consecutive ticks, with the cadence read per-node from the persisted workflow config (defensiveparseWorkflowConfig; every degrade path lands on the DEFAULT 10-min cadence — the widest guaranteed-safe window). A live watcher at ANY configured timeout (incl. 30-min verifier timeouts) always moves the counter inside the window.nodeFailed(..., "timeout")under the durable terminal-status guard (cross-host double settles collapse to one).Tests
test/dag/dag-node-supervision.test.ts— incident harness reproducing the supervision shape at 2s deadlines: healthy control, stream-hang (incident shape), dispose-instance (mechanism + sweep fallback settle), cancel-defect (production InstanceRef die never blocks the settle; mutation-verified), freeze window (live watcher never swept, production cadence relationship), plus pure unit tests for cadence derivation/degrade and window boundaries. 9/9 pass; typecheck + lint ratchet green.Reviewed through a 6-round fixed-point loop (R1–R6); R5/R6 consecutive PASS with zero findings.