Fix graph execution state resume after JSON round-trip#9042
Open
JPPhoto wants to merge 3 commits intoinvoke-ai:mainfrom
Open
Fix graph execution state resume after JSON round-trip#9042JPPhoto wants to merge 3 commits intoinvoke-ai:mainfrom
JPPhoto wants to merge 3 commits intoinvoke-ai:mainfrom
Conversation
07e160a to
85df41d
Compare
9ded36f to
7417733
Compare
5 tasks
7417733 to
ec70216
Compare
ec70216 to
c6d794f
Compare
lstein
requested changes
Apr 24, 2026
Collaborator
There was a problem hiding this comment.
Some suggestions:
_rehydrate_resolved_if_exec_branchesduplicates scheduler logic. The condition-edge loop + copydeep at graph.py:1856-1861 duplicates code at _IfBranchScheduler._apply_condition_inputs (graph.py:177-188). I suggest refactoring so that the scheduling logic is at one place._rehydrate_prepared_exec_metadatasetssource_node_idandstatebutiteration_pathis leftNone. This is eventually fixed by_build_iteration_path, but it would be best to either immediately rehydrateiteration_path, or enter a comment that this is deferred to later.- Shouldn't there be a direct test for
_rehydrate_resolved_if_exec_branches? I'd suggest adding a test where the graph contains anIfInvocation, execute it past the condition, round-trip the state, and assert the correct branch goes to completion.
Collaborator
Author
|
@lstein All should be addressed! |
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
Fix a graph execution resume bug in
invokeai/app/services/shared/graph.pywhereGraphExecutionStatecould stall aftermodel_dump_json()/validate_json()on a partially executed session. The fix rehydrates runtime scheduler state for already-materialized exec nodes after deserialization, and adds a regression test covering partial execution, JSON round-trip, and successful completion.Related Issues / Discussions
QA Instructions
pytest tests/test_graph_execution_state.pynext()stallingruff check --fix invokeai tests scriptsruff format invokeai tests scriptsMerge Plan
Checklist
What's Newcopy (if doing a release after this PR)