dify icon indicating copy to clipboard operation
dify copied to clipboard

multiple branches converge into a single code processing point, only one branch is executed, and an error occurs during code convergence

Open LambdaWs opened this issue 2 years ago • 7 comments

Self Checks

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

Dify version

v0.10.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

After upgrading to the new version(v0.10.1), in cases where multiple branches converge into a single code processing point, only one branch is executed, and an error occurs during code convergence, requiring all branches to have values. However, in the old version, branches that were not executed would default to None, and the code handling the convergence could process this. thank you

✔️ Expected Behavior

branches that were not executed would default to None, and the code handling the convergence could process this.

❌ Actual Behavior

and an error occurs during code convergence, requiring all branches to have values.

LambdaWs avatar Oct 30 '24 12:10 LambdaWs

Hello @LambdaWs! I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's work together to solve this issue.

I found a similar discussion regarding issues with parallel execution in workflows. In version 0.8.0, there was a problem where the issue classifier was treated as a parallel execution branch, which might be related to the problem you're experiencing [1]. You might want to check that discussion for any insights or updates that could help resolve your issue.

To continue talking to Dosu, mention @dosu.

dosubot[bot] avatar Oct 30 '24 12:10 dosubot[bot]

  • Please provide a DSL for us to describe this problem
  • You could try to upgrade to v0.10.2

crazywoola avatar Oct 30 '24 13:10 crazywoola

I also encountered the same problem. When I run six nodes in parallel, with two nodes in each group connecting to the next LLM node or other parameter aggregation node, the fastest node among the six nodes will execute directly downward, causing the pipeline to report an error. However, if I only execute two nodes separately, it will wait for the other slower node to complete execution before continuing to execute downward.

HaiShin avatar Nov 06 '24 07:11 HaiShin

I also encountered the same problem. When I run six nodes in parallel, with two nodes in each group connecting to the next LLM node or other parameter aggregation node, the fastest node among the six nodes will execute directly downward, causing the pipeline to report an error. However, if I only execute two nodes separately, it will wait for the other slower node to complete execution before continuing to execute downward.

dify version is 0.10.2

HaiShin avatar Nov 06 '24 07:11 HaiShin

upgrade to v0.10.2, I also encountered the same problem. @crazywoola

Luckyjy avatar Nov 07 '24 10:11 Luckyjy

app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: workflow
  name: Python Auto
  use_icon_as_answer_icon: false
kind: app
version: 0.1.2
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      image:
        enabled: false
        number_limits: 3
        transfer_methods:
        - remote_url
        - local_file
    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: code
        targetType: end
      id: 1729590961187-source-1729498225357-target
      source: '1729590961187'
      sourceHandle: source
      target: '1729498225357'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: start
        targetType: if-else
      id: 1727170895530-source-1730943302336-target
      source: '1727170895530'
      sourceHandle: source
      target: '1730943302336'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: end
      id: 1730943302336-false-1730943342502-target
      source: '1730943302336'
      sourceHandle: 'false'
      target: '1730943342502'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: code
      id: 1730943302336-true-1730943415131-target
      source: '1730943302336'
      sourceHandle: 'true'
      target: '1730943415131'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: if-else
        targetType: code
      id: 1730943302336-c33fe174-c2e0-44d6-9a6f-d11b8a8d23a1-1730943450923-target
      source: '1730943302336'
      sourceHandle: c33fe174-c2e0-44d6-9a6f-d11b8a8d23a1
      target: '1730943450923'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: code
        targetType: code
      id: 1730943415131-source-1729590961187-target
      source: '1730943415131'
      sourceHandle: source
      target: '1729590961187'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: code
        targetType: code
      id: 1730943450923-source-1729590961187-target
      source: '1730943450923'
      sourceHandle: source
      target: '1729590961187'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 开始
        type: start
        variables:
        - label: on_shelf_name
          max_length: 256
          options: []
          required: true
          type: text-input
          variable: on_shelf_name
      height: 90
      id: '1727170895530'
      position:
        x: -50.80395039634965
        y: 259.9771651848563
      positionAbsolute:
        x: -50.80395039634965
        y: 259.9771651848563
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        desc: ''
        outputs:
        - value_selector:
          - '1729590961187'
          - submit_to_status
          variable: submit_to_status
        - value_selector:
          - '1729590961187'
          - is_fully_automated
          variable: is_fully_automated
        selected: false
        title: 结束 2
        type: end
      height: 116
      id: '1729498225357'
      position:
        x: 1288.741002333703
        y: 230.31495554569
      positionAbsolute:
        x: 1288.741002333703
        y: 230.31495554569
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        code: "\ndef main(arg1: str, arg2: str) -> dict:\n    return {\n        \"\
          submit_to_status\": 'Solve', \"is_fully_automated\": False\n    }\n"
        code_language: python3
        desc: ''
        outputs:
          is_fully_automated:
            children: null
            type: number
          submit_to_status:
            children: null
            type: string
        selected: true
        title: 代码执行
        type: code
        variables:
        - value_selector:
          - '1730943415131'
          - result
          variable: arg1
        - value_selector:
          - '1730943450923'
          - result
          variable: arg2
      height: 54
      id: '1729590961187'
      position:
        x: 968.1575853890733
        y: 230.31495554569
      positionAbsolute:
        x: 968.1575853890733
        y: 230.31495554569
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        cases:
        - case_id: 'true'
          conditions:
          - comparison_operator: contains
            id: fcdd729c-9e7f-443b-8ad1-803ce68e430c
            value: day1
            varType: string
            variable_selector:
            - '1727170895530'
            - on_shelf_name
          id: 'true'
          logical_operator: and
        - case_id: c33fe174-c2e0-44d6-9a6f-d11b8a8d23a1
          conditions:
          - comparison_operator: contains
            id: e962c87f-9af5-4afb-a631-a826d3a67e0c
            value: day2
            varType: string
            variable_selector:
            - '1727170895530'
            - on_shelf_name
          id: c33fe174-c2e0-44d6-9a6f-d11b8a8d23a1
          logical_operator: and
        desc: ''
        selected: false
        title: 条件分支
        type: if-else
      height: 174
      id: '1730943302336'
      position:
        x: 263.42439775508706
        y: 289.561406645949
      positionAbsolute:
        x: 263.42439775508706
        y: 289.561406645949
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        desc: ''
        outputs:
        - value_selector:
          - '1727170895530'
          - on_shelf_name
          variable: note
        selected: false
        title: 结束 2
        type: end
      height: 90
      id: '1730943342502'
      position:
        x: 611.1882349039337
        y: 482.877186708102
      positionAbsolute:
        x: 611.1882349039337
        y: 482.877186708102
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        code: "\ndef main(arg1: str) -> dict:\n    return {\n        \"result\": arg1+'day1',\n\
          \    }\n"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: string
        selected: false
        title: 代码执行 2
        type: code
        variables:
        - value_selector:
          - '1727170895530'
          - on_shelf_name
          variable: arg1
      height: 54
      id: '1730943415131'
      position:
        x: 624.6108233643395
        y: 143.11775684860658
      positionAbsolute:
        x: 624.6108233643395
        y: 143.11775684860658
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        code: "\ndef main(arg1: str) -> dict:\n    return {\n        \"result\": arg1\
          \ + 'day2',\n    }\n"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: string
        selected: false
        title: 代码执行 3
        type: code
        variables:
        - value_selector:
          - '1727170895530'
          - on_shelf_name
          variable: arg1
      height: 54
      id: '1730943450923'
      position:
        x: 598.9142171222097
        y: 364.3511614433348
      positionAbsolute:
        x: 598.9142171222097
        y: 364.3511614433348
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    viewport:
      x: -230.33498100740417
      y: 46.67148718792521
      zoom: 0.9628792726978274

Luckyjy avatar Nov 07 '24 10:11 Luckyjy

Hi, @LambdaWs. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • Reported bug in Dify version 0.10.1 with code processing errors when branches converge without values.
  • Previous behavior defaulted unexecuted branches to None.
  • I suggested checking a related discussion from version 0.8.0.
  • Crazywoola recommended upgrading to version 0.10.2, but the issue persists for users HaiShin and Luckyjy.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of the Dify repository by commenting here.
  • If there is no further activity, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

dosubot[bot] avatar Dec 08 '24 16:12 dosubot[bot]