fix(condition): fix condition block for no outgoing edge (#2306)

* Fix condition block evaluation

* Lint
This commit is contained in:
Siddharth Ganesan
2025-12-10 23:24:27 -08:00
committed by GitHub
parent a881dc1877
commit c550e4591c

View File

@@ -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}`)