[PR #29680] fix: allow Loop/Iteration container nodes as valid graph roots for single-step debugging #32512

Closed
opened 2026-02-21 20:51:33 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/29680

State: closed
Merged: No


Summary

  • Allow LOOP and ITERATION container nodes to be valid graph roots in the root node validator
  • This fixes the INVALID_ROOT error when debugging Loop/Iteration nodes individually in the workflow editor

Problem

When trying to debug a Loop or Iteration node using single-step debugging, the validation fails with:

[INVALID_ROOT] Root node 'xxx' must declare execution type 'root'.

This happens because:

  1. Container nodes (LOOP/ITERATION) have execution_type = CONTAINER, not ROOT
  2. The validator only allowed ITERATION_START and LOOP_START as non-ROOT root nodes
  3. But during single-step debugging, the container node itself becomes the graph root

Solution

  1. Setup SystemVariable properly while single stepping Loop or Iteration node.
  2. Omit the WorkflowPersistenceLayer while single stepping container nodes to ensure that the execution of
    correspond container nodes does not persist.

Test plan

  • Debug a Loop node individually in the workflow editor
  • Debug an Iteration node individually in the workflow editor
  • Verify full workflow execution still works correctly

Closes #28114

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/langgenius/dify/pull/29680 **State:** closed **Merged:** No --- ## Summary - Allow LOOP and ITERATION container nodes to be valid graph roots in the root node validator - This fixes the INVALID_ROOT error when debugging Loop/Iteration nodes individually in the workflow editor ## Problem When trying to debug a Loop or Iteration node using single-step debugging, the validation fails with: ``` [INVALID_ROOT] Root node 'xxx' must declare execution type 'root'. ``` This happens because: 1. Container nodes (LOOP/ITERATION) have `execution_type = CONTAINER`, not `ROOT` 2. The validator only allowed `ITERATION_START` and `LOOP_START` as non-ROOT root nodes 3. But during single-step debugging, the container node itself becomes the graph root ## Solution 1. Setup `SystemVariable` properly while single stepping `Loop` or `Iteration` node. 2. Omit the `WorkflowPersistenceLayer` while single stepping container nodes to ensure that the execution of correspond container nodes does not persist. ## Test plan - [ ] Debug a Loop node individually in the workflow editor - [ ] Debug an Iteration node individually in the workflow editor - [ ] Verify full workflow execution still works correctly Closes #28114 🤖 Generated with [Claude Code](https://claude.com/claude-code)
yindo added the pull-request label 2026-02-21 20:51:33 -05:00
yindo closed this issue 2026-02-21 20:51:33 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#32512