fix(graph): a release killed between its two journal events no longer runs its node twice - #1014
Merged
Merged
Conversation
…s wave consumption The scheduler journals the pinned envelope, then the wave consumption. A process killed between the two left the instance pinned while its gating edges still read satisfied. The restart re-entered the pinned instance AND released a second one, so the node executed twice in one resumed segment. The fold now records wave consumption on the instance. A restart completes a release that never journaled its consumption, from the same decision the crashed process made.
The exported FoldInstance gains a field, so the change ships as a minor.
tangletools
approved these changes
Aug 25, 2026
tangletools
left a comment
Contributor
There was a problem hiding this comment.
Automated approval: author drewstone, all checks green.
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 free
to 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.
Closes #1013.
The defect
release()journals the pinned envelope (node-inputs-resolved), then the wave consumption (join-state). A process killed between the two leaves the instance pinned while its gating edges still read satisfied, so the restart does BOTH:reenterAfterCrashre-enters the pinned instance (correct), andtryReleasesees the unconsumed wave and releases a SECOND instance.The node then executes twice in one resumed segment. Found by agent-dev-container's workflow scheduler, whose notify fired twice through this window on a 3-node chain (journal tail in #1013).
The fix
The fold records wave consumption on the instance (
FoldInstance.waveConsumed, set byjoin-state). A restart that finds a released instance WITHOUT it journals the missingjoin-statebefore spawning, re-deriving the same decision the crashed process made — its gating edges are folded exactly as they were when it released, because their verdicts were journaled first, sodecideJoinanswers identically. Idempotent, and it makes the journal complete rather than papering over it at read time.Proof
tests/graph/replay.test.tsgains a case that kills at the second node's envelope pin and asserts the node runs EXACTLY once on resume (it ran twice before). The existing every-boundary kill sweep and the 58-casetests/kernel/graph.test.tscompatibility bar are unchanged: 143/143 across graph + kernel + topologies. Release gates green (version-bump, docs:check, docs:freshness, testing fixture).