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

Multiple Paths Between IF/ELSE Branches Invalidate Conditions and Execute All Paths #11542

Open
5 tasks done
GreenerZ opened this issue Dec 11, 2024 · 11 comments · May be fixed by #11544 or #11646
Open
5 tasks done

Multiple Paths Between IF/ELSE Branches Invalidate Conditions and Execute All Paths #11542

GreenerZ opened this issue Dec 11, 2024 · 11 comments · May be fixed by #11544 or #11646
Labels
🌊 feat:workflow Workflow related stuff.

Comments

@GreenerZ
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.13.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I have searched for existing issues, and this problem is similar to #10638 and #10564, but the trigger method is more concise.

I want to control the progress branches of a multi-turn dialogue by using IF/ELSE to judge the content of the variable.
But if there are multiple paths connecting two IF/ELSE branches (with one being a direct connection), it will cause the condition of the second branch to become invalid and execute all subsequent paths.

Steps

Situation 1

Here is an example with two conditional branches, one of which has a direct connection path.

image

Temporary solution

Adding an empty component in all paths, such as assigning a value to an empty variable, can temporarily circumvent this issue.

image

Situation 2

If multiple paths leading out of the IF/ELSE connect to the same problem classifier, an error indicating no results will also occur.
image
image

Once this issue occurs, the problem classifier can no longer function properly and can only be deleted and rebuilt.

✔️ Expected Behavior

Execute according to the correct multi-level branching logic structure.

❌ Actual Behavior

The failure of the IF/ELSE condition resulted in all child branches being triggered.

@dosubot dosubot bot added the 🌊 feat:workflow Workflow related stuff. label Dec 11, 2024
Copy link

dosubot bot commented Dec 11, 2024

@GreenerZ Hello! I'm here to help you with your bug report. I can assist with solving bugs, answering questions, and becoming a contributor.

The issue you're experiencing with Dify's workflow engine, where multiple paths between IF/ELSE branches cause all paths to execute, seems to be a bug related to how the engine handles conditional branching. This can lead to the invalidation of conditions and unintended execution of all subsequent paths.

A temporary workaround, as you mentioned, is to add an empty component in all paths, such as assigning a value to an empty variable. This can help circumvent the issue by ensuring that each path has a distinct execution step, which might prevent the conditions from being invalidated.

This problem might be similar to issues #10638 and #10564, indicating that it could be a known bug in the system. If the problem persists, consider checking for updates or patches that might address this issue in future releases of Dify.

To continue talking to Dosu, mention @dosu.


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

@yihong0618
Copy link
Contributor

can you provide your dsl? thanks a lot.

@GreenerZ
Copy link
Author

can you provide your dsl? thanks a lot.

ifelse_issues_20241211.txt

yihong0618 added a commit to yihong0618/dify that referenced this issue Dec 11, 2024
…d Execute All Paths close langgenius#11542

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
@yihong0618
Copy link
Contributor

@GreenerZ fixed can you check ?
using github cli then
using gh pr checkout 11544

@GreenerZ
Copy link
Author

GreenerZ commented Dec 11, 2024

@GreenerZ fixed can you check ? using github cli then using gh pr checkout 11544

i'm trying to pull 11544 to local and cp patched files to docker api and worker container and restart.
Situation 2 has been resolved well,
but the issue with situation 1 still persists.
image
ifelse_issues_20241211_situation1.txt

@yihong0618
Copy link
Contributor

@GreenerZ fixed can you check ? using github cli then using gh pr checkout 11544

i'm trying to pull 11544 to local and cp patched files to docker api and worker container and restart. Situation 2 has been resolved well, but the issue with situation 1 still persists. image ifelse_issues_20241211_situation1.txt

thanks will check this dsl

@yihong0618
Copy link
Contributor

for situation 1 please the workaround for now, there's no better for now, maybe do some dig later

@GreenerZ
Copy link
Author

for situation 1 please the workaround for now, there's no better for now, maybe do some dig later

Okay, I'll temporarily adopt the temporary solution to handle this.

@laipz8200
Copy link
Member

#9560

@GreenerZ
Copy link
Author

#9560
Yes, it should be the same principle that triggers the bug, but the error in his diagram is not the actual mistake; it's located further up in the sequence.
image

yihong0618 added a commit to yihong0618/dify that referenced this issue Dec 13, 2024
…ons and Execute All Paths close langgenius#11542

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
@yihong0618 yihong0618 linked a pull request Dec 13, 2024 that will close this issue
5 tasks
@yihong0618
Copy link
Contributor

@GreenerZ can you try #11646

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌊 feat:workflow Workflow related stuff.
Projects
None yet
3 participants