From c550e4591ce2d7a024a3161211a91971b397f5cb Mon Sep 17 00:00:00 2001 From: Siddharth Ganesan <33737564+Sg312@users.noreply.github.com> Date: Wed, 10 Dec 2025 23:24:27 -0800 Subject: [PATCH] fix(condition): fix condition block for no outgoing edge (#2306) * Fix condition block evaluation * Lint --- .../handlers/condition/condition-handler.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/apps/sim/executor/handlers/condition/condition-handler.ts b/apps/sim/executor/handlers/condition/condition-handler.ts index c6cc0db62..452f40da9 100644 --- a/apps/sim/executor/handlers/condition/condition-handler.ts +++ b/apps/sim/executor/handlers/condition/condition-handler.ts @@ -178,10 +178,20 @@ export class ConditionBlockHandler implements BlockHandler { evalContext ) - const connection = this.findConnectionForCondition(outgoingConnections, condition.id) - - if (connection && conditionMet) { - return { selectedConnection: connection, selectedCondition: condition } + if (conditionMet) { + const connection = this.findConnectionForCondition(outgoingConnections, condition.id) + if (connection) { + return { selectedConnection: connection, selectedCondition: condition } + } + // Condition is true but has no outgoing edge - branch ends gracefully + logger.info( + `Condition "${condition.title}" is true but has no outgoing edge - branch ending`, + { + blockId: block.id, + conditionId: condition.id, + } + ) + return { selectedConnection: null, selectedCondition: null } } } catch (error: any) { logger.error(`Failed to evaluate condition "${condition.title}": ${error.message}`)