diff --git a/backend/workflow_executor.py b/backend/workflow_executor.py index f1a6638..2d78b68 100644 --- a/backend/workflow_executor.py +++ b/backend/workflow_executor.py @@ -412,12 +412,18 @@ def execute_logic_node( # Handle both serialization formats: # UI format: condition = {operands: [...], operator: "and"} # Expected format: condition = {expression: {operands: [...], operator: "and"}} + expression = None + if hasattr(node.condition, 'operator') and hasattr(node.condition, 'operands'): - expression = node.condition # UI format (direct) - elif hasattr(node.condition, 'expression'): - expression = node.condition.expression # Expected format (wrapped) - else: - error_msg = f"Logic node {node.id} has invalid condition structure (missing operator/operands)" + # UI format (direct) - check that operator is not None + if node.condition.operator is not None: + expression = node.condition + elif hasattr(node.condition, 'expression') and node.condition.expression is not None: + # Expected format (wrapped) - check that expression is not None + expression = node.condition.expression + + if expression is None: + error_msg = f"Logic node {node.id} has invalid or empty condition (operator/operands/expression is None or missing)" logger.error(error_msg) return NodeExecutionState( node_id=node.id,