Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow terminates after parallel tasks execution, merge node not triggered #12492

Open
5 tasks done
lazyFrogLOL opened this issue Jan 8, 2025 · 5 comments · May be fixed by #12498
Open
5 tasks done

Workflow terminates after parallel tasks execution, merge node not triggered #12492

lazyFrogLOL opened this issue Jan 8, 2025 · 5 comments · May be fixed by #12498
Assignees
Labels
🐞 bug Something isn't working 🌊 feat:workflow Workflow related stuff.

Comments

@lazyFrogLOL
Copy link

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.14.2

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

I made a simple workflow test case,
image
When two IF-ELSE nodes execute in parallel and their results are merged into a subsequent node, if the input satisfies the IF condition of both nodes simultaneously, the subsequent node will not be executed.
image

I tried to fix this by myself, but the graph engine is too complicated.

✔️ Expected Behavior

The workflow executes properly.

❌ Actual Behavior

The workflow stops early.

@dosubot dosubot bot added 🌊 feat:workflow Workflow related stuff. 🐞 bug Something isn't working labels Jan 8, 2025
Copy link

dosubot bot commented Jan 8, 2025

Hey there, @lazyFrogLOL! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's tackle this issue together!

I found a similar unsolved discussion regarding issues with parallel execution in Dify workflows. The discussion mentions a problem with parallel execution in version 0.8.0, where the issue classifier was treated as a parallel execution branch. You can view the discussion here [1].

Regarding your issue, it seems that the merge node is not being triggered after parallel tasks execution. This could be related to how Dify handles the synchronization of results from parallel branches. Dify uses a queue to collect results from each parallel branch and waits for all branches to succeed before proceeding to the merge node [2]. If the merge node is not triggered, it might be due to a failure in synchronizing these results or an issue with the conditions being met simultaneously.

You might want to check if all parallel branches are completing successfully and if the conditions for triggering the merge node are correctly defined. Additionally, reviewing the error handling mechanisms for parallel branches might provide insights into why the workflow stops early.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@lazyFrogLOL
Copy link
Author

lazyFrogLOL commented Jan 8, 2025

Here is the graph info,

{
  "nodes": [
    {
      "id": "1736213473407",
      "type": "custom",
      "data": {
        "type": "start",
        "title": "\\u5f00\\u59cb",
        "desc": "",
        "variables": [
          {
            "variable": "text1",
            "label": "text1",
            "type": "text-input",
            "max_length": 48,
            "required": true,
            "options": []
          },
          {
            "variable": "text2",
            "label": "text2",
            "type": "text-input",
            "max_length": 48,
            "required": true,
            "options": []
          }
        ],
        "selected": false
      },
      "position": { "x": 80, "y": 282 },
      "targetPosition": "left",
      "sourcePosition": "right",
      "positionAbsolute": { "x": 80, "y": 282 },
      "width": 244,
      "height": 116,
      "selected": false
    },
    {
      "id": "1736213481652",
      "type": "custom",
      "data": {
        "type": "if-else",
        "title": "\\u6761\\u4ef6\\u5206\\u652f",
        "desc": "",
        "cases": [
          {
            "id": "true",
            "case_id": "true",
            "logical_operator": "and",
            "conditions": [
              {
                "id": "ad0c54ef-ed3a-451b-a0c3-3b85fd8bf3e6",
                "varType": "string",
                "variable_selector": ["1736213473407", "text1"],
                "comparison_operator": "is",
                "value": "1"
              }
            ]
          },
          {
            "case_id": "273288c5-9824-42a5-8b2a-d94570be00af",
            "logical_operator": "and",
            "conditions": [
              {
                "id": "65c9b8d8-a972-4130-9e0a-585010652fb6",
                "varType": "string",
                "variable_selector": ["1736213473407", "text1"],
                "comparison_operator": "is",
                "value": "2"
              }
            ]
          }
        ],
        "selected": false
      },
      "position": { "x": 593, "y": 282 },
      "targetPosition": "left",
      "sourcePosition": "right",
      "positionAbsolute": { "x": 593, "y": 282 },
      "width": 244,
      "height": 174,
      "selected": false
    },
    {
      "id": "1736213508675",
      "type": "custom",
      "data": {
        "type": "end",
        "title": "\\u7ed3\\u675f",
        "desc": "",
        "outputs": [
          {
            "variable": "output",
            "value_selector": ["1736213571650", "output"]
          },
          {
            "variable": "output",
            "value_selector": ["1736213560107", "output"]
          }
        ],
        "selected": false
      },
      "position": { "x": 1504, "y": 394 },
      "targetPosition": "left",
      "sourcePosition": "right",
      "positionAbsolute": { "x": 1504, "y": 394 },
      "width": 244,
      "height": 116,
      "selected": true
    },
    {
      "id": "1736213560107",
      "type": "custom",
      "data": {
        "type": "template-transform",
        "title": "\\u6a21\\u677f\\u8f6c\\u6362",
        "desc": "",
        "variables": [],
        "template": "text1\\u662f1\\uff0ctext2\\u662f1",
        "selected": false
      },
      "position": { "x": 1034, "y": 307 },
      "targetPosition": "left",
      "sourcePosition": "right",
      "positionAbsolute": { "x": 1034, "y": 307 },
      "width": 244,
      "height": 54,
      "selected": false
    },
    {
      "id": "1736213571650",
      "type": "custom",
      "data": {
        "type": "template-transform",
        "title": "\\u6a21\\u677f\\u8f6c\\u6362 2",
        "desc": "",
        "variables": [],
        "template": "text1\\u662f2\\uff0ctext2\\u662f2",
        "selected": false
      },
      "position": { "x": 1019, "y": 539 },
      "targetPosition": "left",
      "sourcePosition": "right",
      "positionAbsolute": { "x": 1019, "y": 539 },
      "width": 244,
      "height": 54,
      "selected": false
    },
    {
      "id": "1736213590381",
      "type": "custom",
      "data": {
        "type": "if-else",
        "title": "\\u6761\\u4ef6\\u5206\\u652f 2",
        "desc": "",
        "cases": [
          {
            "id": "true",
            "case_id": "true",
            "logical_operator": "and",
            "conditions": [
              {
                "id": "0bf11bec-3cc4-47e5-8af0-fb3b3daa94c4",
                "varType": "string",
                "variable_selector": ["1736213473407", "text2"],
                "comparison_operator": "is",
                "value": "1"
              }
            ]
          },
          {
            "case_id": "4e1314d7-4330-4996-b602-43a3736f4475",
            "logical_operator": "and",
            "conditions": [
              {
                "id": "48899b96-7642-4428-99ea-75c9b9f47291",
                "varType": "string",
                "variable_selector": ["1736213473407", "text2"],
                "comparison_operator": "contains",
                "value": "2"
              }
            ]
          }
        ],
        "selected": false
      },
      "position": { "x": 593, "y": 495 },
      "targetPosition": "left",
      "sourcePosition": "right",
      "positionAbsolute": { "x": 593, "y": 495 },
      "width": 244,
      "height": 174,
      "selected": false
    }
  ],
  "edges": [
    {
      "id": "1736213473407-source-1736213481652-target",
      "type": "custom",
      "source": "1736213473407",
      "sourceHandle": "source",
      "target": "1736213481652",
      "targetHandle": "target",
      "data": {
        "sourceType": "start",
        "targetType": "if-else",
        "isInIteration": false
      },
      "zIndex": 0
    },
    {
      "id": "1736213481652-true-1736213560107-target",
      "type": "custom",
      "source": "1736213481652",
      "sourceHandle": "true",
      "target": "1736213560107",
      "targetHandle": "target",
      "data": {
        "sourceType": "if-else",
        "targetType": "template-transform",
        "isInIteration": false
      },
      "zIndex": 0
    },
    {
      "id": "1736213481652-273288c5-9824-42a5-8b2a-d94570be00af-1736213571650-target",
      "type": "custom",
      "source": "1736213481652",
      "sourceHandle": "273288c5-9824-42a5-8b2a-d94570be00af",
      "target": "1736213571650",
      "targetHandle": "target",
      "data": {
        "sourceType": "if-else",
        "targetType": "template-transform",
        "isInIteration": false
      },
      "zIndex": 0
    },
    {
      "id": "1736213473407-source-1736213590381-target",
      "type": "custom",
      "source": "1736213473407",
      "sourceHandle": "source",
      "target": "1736213590381",
      "targetHandle": "target",
      "data": {
        "sourceType": "start",
        "targetType": "if-else",
        "isInIteration": false
      },
      "zIndex": 0
    },
    {
      "id": "1736213590381-true-1736213560107-target",
      "type": "custom",
      "source": "1736213590381",
      "target": "1736213560107",
      "sourceHandle": "true",
      "targetHandle": "target",
      "data": {
        "sourceType": "if-else",
        "targetType": "template-transform",
        "isInIteration": false
      },
      "zIndex": 0
    },
    {
      "id": "1736213590381-4e1314d7-4330-4996-b602-43a3736f4475-1736213571650-target",
      "type": "custom",
      "source": "1736213590381",
      "target": "1736213571650",
      "sourceHandle": "4e1314d7-4330-4996-b602-43a3736f4475",
      "targetHandle": "target",
      "data": {
        "sourceType": "if-else",
        "targetType": "template-transform",
        "isInIteration": false
      },
      "zIndex": 0
    },
    {
      "id": "1736213560107-source-1736213508675-target",
      "type": "custom",
      "source": "1736213560107",
      "target": "1736213508675",
      "sourceHandle": "source",
      "targetHandle": "target",
      "data": {
        "sourceType": "template-transform",
        "targetType": "end",
        "isInIteration": false
      },
      "zIndex": 0
    },
    {
      "id": "1736213571650-source-1736213508675-target",
      "type": "custom",
      "source": "1736213571650",
      "target": "1736213508675",
      "sourceHandle": "source",
      "targetHandle": "target",
      "data": {
        "sourceType": "template-transform",
        "targetType": "end",
        "isInIteration": false
      },
      "zIndex": 0
    }
  ],
  "viewport": { "x": 257, "y": 10.5, "zoom": 1 }
}

@crazywoola
Copy link
Member

Please provide the DSL as well.

@lazyFrogLOL
Copy link
Author

Here is the DSL content.

app:
  description: 用于测试图连接
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: workflow
  name: 测试应用
  use_icon_as_answer_icon: false
kind: app
version: 0.1.5
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      allowed_file_extensions:
      - .JPG
      - .JPEG
      - .PNG
      - .GIF
      - .WEBP
      - .SVG
      allowed_file_types:
      - image
      allowed_file_upload_methods:
      - local_file
      - remote_url
      enabled: false
      fileUploadConfig:
        audio_file_size_limit: 50
        batch_count_limit: 5
        file_size_limit: 15
        image_file_size_limit: 10
        video_file_size_limit: 100
        workflow_file_upload_limit: 10
      image:
        enabled: false
        number_limits: 3
        transfer_methods:
        - local_file
        - remote_url
      number_limits: 3
    opening_statement: ''
    retriever_resource:
      enabled: true
    sensitive_word_avoidance:
      enabled: false
    speech_to_text:
      enabled: false
    suggested_questions: []
    suggested_questions_after_answer:
      enabled: false
    text_to_speech:
      enabled: false
      language: ''
      voice: ''
  graph:
    edges:
    - data:
        isInIteration: false
        sourceType: start
        targetType: if-else
      id: 1736213473407-source-1736213481652-target
      source: '1736213473407'
      sourceHandle: source
      target: '1736213481652'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: template-transform
      id: 1736213481652-true-1736213560107-target
      source: '1736213481652'
      sourceHandle: 'true'
      target: '1736213560107'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: template-transform
      id: 1736213481652-273288c5-9824-42a5-8b2a-d94570be00af-1736213571650-target
      source: '1736213481652'
      sourceHandle: 273288c5-9824-42a5-8b2a-d94570be00af
      target: '1736213571650'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: start
        targetType: if-else
      id: 1736213473407-source-1736213590381-target
      source: '1736213473407'
      sourceHandle: source
      target: '1736213590381'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: template-transform
      id: 1736213590381-true-1736213560107-target
      source: '1736213590381'
      sourceHandle: 'true'
      target: '1736213560107'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: template-transform
      id: 1736213590381-4e1314d7-4330-4996-b602-43a3736f4475-1736213571650-target
      source: '1736213590381'
      sourceHandle: 4e1314d7-4330-4996-b602-43a3736f4475
      target: '1736213571650'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: template-transform
        targetType: end
      id: 1736213560107-source-1736326127484-target
      source: '1736213560107'
      sourceHandle: source
      target: '1736326127484'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: template-transform
        targetType: end
      id: 1736213571650-source-1736326129844-target
      source: '1736213571650'
      sourceHandle: source
      target: '1736326129844'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 开始
        type: start
        variables:
        - label: text1
          max_length: 48
          options: []
          required: true
          type: text-input
          variable: text1
        - label: text2
          max_length: 48
          options: []
          required: true
          type: text-input
          variable: text2
      height: 116
      id: '1736213473407'
      position:
        x: 80
        y: 282
      positionAbsolute:
        x: 80
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        cases:
        - case_id: 'true'
          conditions:
          - comparison_operator: is
            id: ad0c54ef-ed3a-451b-a0c3-3b85fd8bf3e6
            value: '1'
            varType: string
            variable_selector:
            - '1736213473407'
            - text1
          id: 'true'
          logical_operator: and
        - case_id: 273288c5-9824-42a5-8b2a-d94570be00af
          conditions:
          - comparison_operator: is
            id: 65c9b8d8-a972-4130-9e0a-585010652fb6
            value: '2'
            varType: string
            variable_selector:
            - '1736213473407'
            - text1
          id: 273288c5-9824-42a5-8b2a-d94570be00af
          logical_operator: and
        desc: ''
        selected: false
        title: 条件分支
        type: if-else
      height: 174
      id: '1736213481652'
      position:
        x: 593
        y: 282
      positionAbsolute:
        x: 593
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        desc: ''
        selected: false
        template: text1是1,text2是1
        title: 模板转换 1
        type: template-transform
        variables: []
      height: 54
      id: '1736213560107'
      position:
        x: 1071.8526995945472
        y: 309.2490510465765
      positionAbsolute:
        x: 1071.8526995945472
        y: 309.2490510465765
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        desc: ''
        selected: false
        template: text1是2,text2是2
        title: 模板转换 2
        type: template-transform
        variables: []
      height: 54
      id: '1736213571650'
      position:
        x: 1071.8526995945472
        y: 570.4867146520705
      positionAbsolute:
        x: 1071.8526995945472
        y: 570.4867146520705
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        cases:
        - case_id: 'true'
          conditions:
          - comparison_operator: is
            id: 0bf11bec-3cc4-47e5-8af0-fb3b3daa94c4
            value: '1'
            varType: string
            variable_selector:
            - '1736213473407'
            - text2
          id: 'true'
          logical_operator: and
        - case_id: 4e1314d7-4330-4996-b602-43a3736f4475
          conditions:
          - comparison_operator: contains
            id: 48899b96-7642-4428-99ea-75c9b9f47291
            value: '2'
            varType: string
            variable_selector:
            - '1736213473407'
            - text2
          logical_operator: and
        desc: ''
        selected: false
        title: 条件分支 2
        type: if-else
      height: 174
      id: '1736213590381'
      position:
        x: 593
        y: 495
      positionAbsolute:
        x: 593
        y: 495
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        desc: ''
        outputs:
        - value_selector:
          - '1736213560107'
          - output
          variable: output
        selected: false
        title: 结束
        type: end
      height: 90
      id: '1736326127484'
      position:
        x: 1375.8526995945472
        y: 309.2490510465765
      positionAbsolute:
        x: 1375.8526995945472
        y: 309.2490510465765
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        desc: ''
        outputs:
        - value_selector:
          - '1736213571650'
          - output
          variable: output
        selected: false
        title: 结束 2
        type: end
      height: 90
      id: '1736326129844'
      position:
        x: 1375.8526995945472
        y: 570.4867146520705
      positionAbsolute:
        x: 1375.8526995945472
        y: 570.4867146520705
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    viewport:
      x: 53.73153413917862
      y: 92.33788151606495
      zoom: 0.8353748444019405

@yihong0618
Copy link
Contributor

interesting, will take a look, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 🌊 feat:workflow Workflow related stuff.
Projects
None yet
4 participants