Skip to content

Conversation

@AustinMroz
Copy link
Contributor

Prior to this commit, subgraphNode inconsistently refers to either the parent graph, or to indicate the current node is a subgraph.

This corrects the usage of subgraphNode to consistently refer to the subgraph instance as defined in the constructor.

This requires a corresponding frontend commit to function, and solves a bug where graph serialization fails due to an incorrectly reported infinite loop.

Prior to this commit, subgraphNode inconsistently refers to either the
parent graph, or to indicate the current node is a subgraph.

This corrects the usage of subgraphNode to consistently refer to the
subgraph instance as defined in the constructor.

This requires a corresponding frontend commit to function, and solves a
bug where graph serialization fails due to an incorrectly reported
infinite loop.
Copy link
Contributor

@christian-byrne christian-byrne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix correctly addresses a semantic error in ExecutableNodeDTO.getInnerNodes() where subgraphNode was being misused.

The subgraphNode property in ExecutableNodeDTO refers to the parent SubgraphNode instance that contains the current node, not whether the current node itself is a subgraph. The original code was checking 'does this node have a parent subgraph?' when it should have been checking 'is this node itself a subgraph that needs flattening?'

The corrected version using this.node.isSubgraphNode() properly identifies when the wrapped node is a SubgraphNode that contains inner nodes requiring recursive flattening. This aligns with the DTO pattern's purpose of wrapping nodes with execution context while maintaining separation between node properties and execution state.

Without this fix, the incorrect traversal during graph flattening would trigger false positive infinite loop detection during serialization, particularly when dealing with nested subgraph structures. The ExecutableNodeDTO acts as a decorator that adds hierarchical path information (like '1:2:3') for execution tracking, and proper node type checking is essential for maintaining this hierarchy.

This is a clean, minimal fix that resolves the serialization bug without any architectural changes or side effects.

@christian-byrne christian-byrne merged commit 0207794 into Comfy-Org:master Aug 5, 2025
4 checks passed
@christian-byrne
Copy link
Contributor

christian-byrne commented Aug 5, 2025

Comfy-Org/ComfyUI_frontend#4686 will still be unresolved until Comfy-Org/ComfyUI_frontend#4688

benceruleanlu added a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request Aug 5, 2025
Prior to this commit, subgraphNode inconsistently refers to either the
parent graph, or to indicate the current node is a subgraph.

This corrects the usage of subgraphNode to consistently refer to the
subgraph instance as defined in the constructor.

This solves a bug where graph serialization fails due to an incorrectly
reported infinite loop.

Port of Comfy-Org/litegraph.js#1193
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants