You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gcgj-dify-1.7.0/api/core/workflow
xuzijie1995 b13ae784a4 fix(workflow): Resolve streaming failure on conditional join points
Improves the robustness of the workflow engine's streaming output by fixing two core issues that caused streaming to fail in complex topologies where multiple conditional branches merge.

**1. Corrected Runtime State Management ("Pruning"):**

The primary bug was located in the `_remove_unreachable_nodes` method. Its aggressive recursive "pruning" algorithm incorrectly removed shared downstream nodes (including LLM and Answer) when handling conditional branches that led to a join point. This prematurely emptied the `rest_node_ids` list, causing the stream processor to fail its initial state check.

The fix replaces the recursive logic with a more conservative, non-recursive approach that only prunes the immediate first node of an unreachable branch. This ensures the integrity of the `rest_node_ids` list throughout the workflow execution.

**2. Improved Static Dependency Analysis:**

A secondary, underlying issue was found in the static dependency analysis (`_recursive_fetch_answer_dependencies`). It incorrectly identified all upstream, mutually exclusive `If/Else` nodes as parallel dependencies of the Answer node.

The fix enhances this analysis by adding "join point awareness". The upward trace now stops when it encounters a node with more than one incoming edge, correctly identifying the join point itself as the dependency rather than its upstream branches.

Together, these changes ensure that streaming output remains reliable and predictable, even in complex workflows with reusable, multi-input nodes.
10 months ago
..
callbacks update worklow events logs. (#19871) 10 months ago
entities minor code fix: remove duplicate type check branch (#22536) 10 months ago
graph_engine fix(workflow): Resolve streaming failure on conditional join points 10 months ago
nodes fix(workflow): Resolve streaming failure on conditional join points 10 months ago
repositories feat(workflow_cycle_manager): Removes redundant repository methods and adds caching (#22597) 10 months ago
utils refactor: move structured output support outside LLM Node (#21565) 11 months ago
__init__.py FEAT: NEW WORKFLOW ENGINE (#3160) 2 years ago
constants.py feat/enhance the multi-modal support (#8818) 2 years ago
conversation_variable_updater.py feat: Persist Variables for Enhanced Debugging Workflow (#20699) 11 months ago
enums.py refactor(api/core/workflow/enums): Rename WORKFLOW_RUN_ID to WORKFLOW_EXECUTION_ID (#20459) 11 months ago
errors.py refactor: decouple Node and NodeData (#22581) 10 months ago
system_variable.py refactor(api): Separate SegmentType for Integer/Float to Enable Pydantic Serialization (#22025) 10 months ago
variable_loader.py fix(api): adding variable to variable pool recursively while loading draft variables. (#21478) 11 months ago
workflow_cycle_manager.py Fix/replace datetime patterns with naive utc now (#22654) 10 months ago
workflow_engine_manager.py feat: Parallel Execution of Nodes in Workflows (#8192) 2 years ago
workflow_entry.py refactor: decouple Node and NodeData (#22581) 10 months ago
workflow_type_encoder.py fix: drop dead code phase2 unused class (#22042) 10 months ago