Skip to content

bug(response-stream): Workflow Tool fails when both workflows reuse a Loop ID #452

Todo

Description

@WH-2099

Graphon 0.9.0 fails when a workflow called as a tool contains a Loop whose node ID matches a Loop in the caller.
The IDs are unique within each workflow.

To reproduce in Dify:

  1. Create workflow B with Start → Loop → End, and Loop Start → Loop End inside the loop. Publish it as a Workflow Tool.
  2. Create chatflow A with Start → Loop → Answer. Inside its loop, connect Loop Start → Workflow Tool B → Answer.
  3. Set both loops to run once. In the exported DSLs, give both Loop nodes the ID outer-loop, update their internal references consistently, import them, and run A.
  4. Repeat with only B's Loop ID changed to source-loop and its references updated.
Loop IDs across A and B Previous Graphon (4fa2214) Graphon 0.9.0
Different Succeeds Succeeds
Same Succeeds Fails

The failing run raises KeyError in _ReplyOrder._get_or_create_container() when it looks up the called workflow's parent frame.
ResponseStreamFilter accepts the foreign loop by its matching node ID, although that parent is absent from its reply records.

Expected: reusing a node ID across separate workflows should not affect execution.

Related: #356, #437. Reproduced while validating langgenius/dify#45356.

AI assistance: Codex helped reproduce the behavior and draft this report.

Activity

  1. self-assigned this
    on Dec 1, 2026
  2. changed the title [-]bug(response-stream): Workflow Tool fails when its Loop ID matches the caller[/-] [+]bug(response-stream): Workflow Tool fails when both workflows reuse a Loop ID[/+] on Dec 1, 2026
  3. dosubot commented on Dec 1, 2026

    @dosubot

    I’d put the guard in ResponseStreamFilter._start_frame_session(), before it calls reply ordering. It currently checks the Loop ID against the caller’s response containers, then registers the frame before build_child_graph() can reject it. I’d check that the parent frame is tracked and that the container belongs to that parent’s graph. Moving build_child_graph() earlier wouldn’t be enough on its own: it matches body nodes by local ID too, so those can collide across workflows as well. [1] [2] [3]

    test_response_reply_ordering.py already feeds FrameStartedEvent directly to the filter. A regression test there could reuse both the Loop ID and its body IDs under an untracked Workflow Tool frame, then assert that the caller’s Answer still streams exactly once and in order. [4]

    To reply, just mention @dosu.


    Docs are dead. Just use Dosu.

    Leave Feedback Ask Dosu about graphon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions