Repository navigation
fix(flows): route a condition node only along its own edges - #1748
Merged
Merged
Conversation
Duplicating a condition node kept its case ids and otherwiseId, which are the edge source handles. The worker resolved the next node by handle id alone, so with two nodes sharing a case id it could follow the other node's edge and send the contact down a branch it never matched. The condition handler now also matches the edge's source node, so flows that already hold duplicated ids route correctly without being edited. Duplicate now gives every case and the otherwise handle a new id.
hello-jackytruong
referenced
this pull request
in hello-jackytruong/ChatWorkAI
Nov 22, 2026
Duplicating a condition node kept its case ids and otherwiseId, which are the edge source handles. The worker resolved the next node by handle id alone, so with two nodes sharing a case id it could follow the other node's edge and send the contact down a branch it never matched. The condition handler now also matches the edge's source node, so flows that already hold duplicated ids route correctly without being edited. Duplicate now gives every case and the otherwise handle a new id. Co-authored-by: Deathgiver <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
otherwiseId. Those ids are the edge source handles. The worker found the next node by handle id alone (seekConnectedNode), so when two nodes shared a case id it could pick the other node's edge.Changes
apps/worker/src/integration/handlers/flow-utils.ts:seekConnectedNodetakes an optionalsourceNodeId. NewfindNodeIdContainingStephelper.apps/worker/src/integration/handlers/condition.ts: looks up the next node from this condition node's own edges.apps/builder/src/features/flows/react-flow/toolbar/duplicate-node-data.ts: gives condition case ids andotherwiseIdnew ids on Duplicate. Split-traffic cases have no id and are unchanged.condition-handler.test.ts: regression for two nodes that share a case id. It fails without the worker fix.duplicate-node-data.test.ts: the duplicated condition gets new ids and keeps its conditions.Other step handlers keep the handle-only lookup. Their handle ids (state, button, option ids) were already given new ids on Duplicate. Analytics does not read condition case ids.
Test plan
vitestcondition-handler + flow (seekConnectedNode) in workervitestduplicate-node-data in builderpnpm --filter worker check-types,pnpm --filter builder check-typespnpm lint(full) in CI🤖 Generated with Claude Code