Repository navigation
fix(graph): keep fan-in node out of resume while a parallel sibling is in-flight - #3390
Merged
opieter-aws merged 3 commits intoJul 22, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
opieter-aws
marked this pull request as ready for review
July 21, 2026 18:29
opieter-aws
requested review from
arielnabavian
and removed request for
arielnabavian
July 21, 2026 18:29
Contributor
|
Assessment: Approve Well-reasoned fix for a subtle mid-flight-serialize concurrency bug. The distinction between a live pending parent and a bypassed dead branch is correct, and the change is strictly more conservative — adding Review Categories
Nicely scoped change with regression coverage that provably guards against the double-run. |
Unshure
approved these changes
Jul 22, 2026
This was referenced Aug 4, 2026
This was referenced Aug 4, 2026
Merged
9 tasks done
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.
Description
When a session-backed graph is serialized mid-execution,
serialize_stateruns from the per-nodeAfterNodeCallEventhook — so it fires while sibling nodes in the same parallel batch are still executing. An in-flight sibling is in none of the terminal sets (completed/interrupted/failed), and_is_node_ready_for_resumetreated any such untouched edge source as a bypassed dead branch. In a fan-in (AND-join), that dropped the in-flight parent's edge and marked the join node ready off its already-completed parent alone. On restore, the persisted frontier contained both the still-pending parent and the join node, so the join ran twice — its first run seeing incomplete inputs — duplicating side effects.The fix distinguishes a live pending parent from a genuinely bypassed branch.
_compute_pending_sourcesseeds from the nodes actually executing at serialize time (execution_status == EXECUTING) plus completed nodes, then walks traversable edges forward to collect every not-yet-completed node that will run on resume. A fan-in node stays out of the resume frontier while any such parent is outstanding. The executing-node seed is the authoritative in-flight signal and covers siblings with no completed ancestor (e.g. two concurrent entry points feeding one join), which forward reachability from completed nodes alone would miss.Related Issues
Requirement for #3283
Documentation PR
N/A
Type of Change
Bug fix
Testing
Ran the multiagent unit suite (
tests/strands/multiagent/), which covers the graph resume/serialize frontier logic, the interrupt-resume path, and the conditional-skip/bypass cases that must remain unaffected. Added regression coverage for both in-flight-sibling shapes (diamond with a shared root, and two independent entry points), each as a full serialize → deserialize → resume round-trip that captures a real mid-flight snapshot; both fail against the pre-fix code (frontier['right', 'join'], join runs twice) and pass with the fix.Ran the suite,
ruff check,ruff format --check, andmypyon the changed files directly rather than viahatch run prepare, which fails in this environment building an unrelated optionalcedarRust dependency.hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.