fix(executor): track For Each iteration bodies in pendingTasks#1182
Open
fix(executor): track For Each iteration bodies in pendingTasks#1182
Conversation
Parallel For Each iterations were silently dropping body steps when the SDK's checkpoint resume severed the iteration's await chain after the first body step. The downstream step (e.g., HTTP Request after a Code step) was never scheduled, the iteration appeared successful, and the workflow finalised with status "success" missing the dropped work. Wrap each iteration body's executeBodyNode call in pendingTasks.track so the workflow-end drain holds strong references to in-flight body chains. Sequential mode is unaffected. Mirrors the KEEP-395 fix that protects the main DAG from the same SDK truncation. Adds a drain-loop simulator covering the For Each parallel pattern.
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.
Summary
successmissing the dropped work.executeBodyNodecall is now wrapped inpendingTasks.track, so the workflow-end drain holds a strong reference to in-flight body chains and recovers orphaned continuations. Sequential mode is unaffected. Mirrors the KEEP-395 fix that protects the main DAG from the same class of SDK truncation.Test plan
pnpm vitest run tests/unit/executor-drain-loop.test.ts-- newsimulates parallel For Each iterations: drain rescues truncated body recursioncase passes alongside the existing KEEP-395 drain-loop testspnpm vitest run tests/unit/for-each-body-runner.test.ts tests/unit/for-each-body-recursion.test.ts tests/unit/for-each-executor.test.ts tests/unit/for-each-concurrency.test.ts-- no regressionspnpm type-check-- cleantest-parallel-iteration-bugworkflow on a deployed branch and confirm parallel mode records all body steps (e.g., 4 iterations -> 4 decode + 4 HTTP) instead of dropping iterations after the first step