From 09e5bad62e19d7a26348b7fbedea25f74c4852ed Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 4 Nov 2024 09:42:33 +0000 Subject: [PATCH] Fix issue with branching bindings --- packages/server/src/automations/steps/branch.ts | 12 ++++++++++-- packages/server/src/threads/automation.ts | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/server/src/automations/steps/branch.ts b/packages/server/src/automations/steps/branch.ts index 56396488cb..041a0c4a64 100644 --- a/packages/server/src/automations/steps/branch.ts +++ b/packages/server/src/automations/steps/branch.ts @@ -39,9 +39,17 @@ export const definition: AutomationStepDefinition = { branchName: { type: AutomationIOType.STRING, }, - result: { + status: { + type: AutomationIOType.STRING, + description: "Branch result", + }, + branchId: { + type: AutomationIOType.STRING, + description: "Branch ID", + }, + success: { type: AutomationIOType.BOOLEAN, - description: "Whether the condition was met", + description: "Branch success", }, }, required: ["output"], diff --git a/packages/server/src/threads/automation.ts b/packages/server/src/threads/automation.ts index 0e87b39f6a..b37ec8dc73 100644 --- a/packages/server/src/threads/automation.ts +++ b/packages/server/src/threads/automation.ts @@ -516,6 +516,7 @@ class Orchestrator { const condition = await this.evaluateBranchCondition(branch.condition) if (condition) { const branchStatus = { + branchName: branch.name, status: `${branch.name} branch taken`, branchId: `${branch.id}`, success: true, @@ -528,6 +529,7 @@ class Orchestrator { branchStatus ) this.context.steps[this.context.steps.length] = branchStatus + this.context.stepsById[branchStep.id] = branchStatus const branchSteps = children?.[branch.id] || [] // A final +1 to accomodate the branch step itself