From 8ea369924ab04719c3b64a83664562c2016155ec Mon Sep 17 00:00:00 2001 From: Pranay Prakash Date: Wed, 3 Jun 2026 23:33:05 -0700 Subject: [PATCH] fix: wait for aborted parallel steps to settle --- workbench/example/workflows/99_e2e.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/workbench/example/workflows/99_e2e.ts b/workbench/example/workflows/99_e2e.ts index 45137367cb..bd725c3937 100644 --- a/workbench/example/workflows/99_e2e.ts +++ b/workbench/example/workflows/99_e2e.ts @@ -1829,18 +1829,23 @@ export async function abortParallelWorkflow() { 'use workflow'; const controller = new AbortController(); + const parallelSteps = Promise.all([ + longStep(controller.signal), + longStep(controller.signal), + longStep(controller.signal), + ]); const result = await Promise.race([ - Promise.all([ - longStep(controller.signal), - longStep(controller.signal), - longStep(controller.signal), - ]), + parallelSteps, sleep('3s').then(() => 'timeout' as const), ]); if (result === 'timeout') { controller.abort(); + // Wait for the in-flight steps to observe the abort before completing the + // workflow. Returning immediately leaves the parallel branch dangling and + // can keep the run open until the steps hit their natural 30s completion. + await parallelSteps; return { status: 'timed out' }; }