You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Next blocks (linked with a single arrow) — These are blocks with trigger conditions. Only one will be called after the user sends a message.
An attached block (linked with a double arrow) — This block is called automatically without any triggers.
A block cannot have both nextBlocks and an attachedBlock.
Current Issue:
The user can attach a block to itself, potentially causing an infinite loop if the block triggers itself continuously. This was partially handled in a previous PR (the check exists only on the frontend but not the backend).
Problem:
Generalized issue: The same problem can occur when two or more blocks are attached to each other, forming an infinite loop (e.g., Block A attaches to Block B, and Block B attaches back to Block A).
Solution:
To prevent this, we need to:
1- Add a check in the backend API to detect and prevent circular attachments.
2- Add a check in the frontend to detect this issue as well.
3- Optionally, in the frontend, display a warning toast when the user attempts to complete the final link that would create a circular reference.
Circular Attachment Detection Algorithm:
Start at the source block and check if it has an attached block (the destination block).
Follow the chain: For each destination block, check if it also has an attached block.
Two possible outcomes:
No circular loop: The chain reaches a block with no attached block (valid scenario, the link is accepted).
Circular loop detected: The chain loops back to the original source block (invalid scenario, the link is rejected).
Reproduction steps
1. Go to visual editor
2. link a block A to a block B (with the double arrow)
3. link a block B to a block A (also with the double arrow)
4. trigger one of these two blocks in a conversation
5. see infinite loop
to stop the loop you can simply break it by removing one of the blocks or a link
Logs
No response
Browsers
No response
OS
No response
The text was updated successfully, but these errors were encountered:
Description:
A block can either have:
A block cannot have both
nextBlocks
and anattachedBlock
.Current Issue:
Problem:
Solution:
To prevent this, we need to:
1- Add a check in the backend API to detect and prevent circular attachments.
2- Add a check in the frontend to detect this issue as well.
3- Optionally, in the frontend, display a warning toast when the user attempts to complete the final link that would create a circular reference.
Circular Attachment Detection Algorithm:
Reproduction steps
Logs
No response
Browsers
No response
OS
No response
The text was updated successfully, but these errors were encountered: