diff --git a/ts/src/ExecutionConstants.ts b/ts/src/ExecutionConstants.ts index 11daeab..390286b 100644 --- a/ts/src/ExecutionConstants.ts +++ b/ts/src/ExecutionConstants.ts @@ -9,4 +9,5 @@ export const ExecutionConstants = { SKIPPED_BY_CONDITION: "Skipped by condition evaluation.", EXECUTION_STRATEGY_FAILED: "Execution strategy failed.", WORKFLOW_CANCELLED: "Workflow cancelled.", + WORKFLOW_DEADLOCKED: "Workflow deadlocked: pending tasks remain with nothing running.", }; diff --git a/ts/src/WorkflowExecutor.ts b/ts/src/WorkflowExecutor.ts index 443ab3f..27c6467 100644 --- a/ts/src/WorkflowExecutor.ts +++ b/ts/src/WorkflowExecutor.ts @@ -86,7 +86,11 @@ export class WorkflowExecutor { } // Ensure everything is accounted for (e.g. if loop exited early) - this.stateManager.cancelAllPending(ExecutionConstants.WORKFLOW_CANCELLED); + this.stateManager.cancelAllPending( + signal?.aborted + ? ExecutionConstants.WORKFLOW_CANCELLED + : ExecutionConstants.WORKFLOW_DEADLOCKED, + ); const results = this.stateManager.getResults(); this.eventBus.emit("workflowEnd", { context: this.context, results });