From 70c1df6f2fb4b6cba00feb6e01f1cac1c9b80339 Mon Sep 17 00:00:00 2001 From: Peter Wielander Date: Thu, 15 Jan 2026 19:22:26 +0100 Subject: [PATCH] [web] [core] Ensure re-running Run from o11y UI will use specified world Signed-off-by: Peter Wielander --- .changeset/tricky-impalas-clean.md | 5 +++++ .changeset/whole-walls-walk.md | 5 +++++ packages/core/src/runtime/start.ts | 10 ++++++++-- packages/web-shared/src/api/workflow-server-actions.ts | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 .changeset/tricky-impalas-clean.md create mode 100644 .changeset/whole-walls-walk.md diff --git a/.changeset/tricky-impalas-clean.md b/.changeset/tricky-impalas-clean.md new file mode 100644 index 0000000000..337e9b7c0e --- /dev/null +++ b/.changeset/tricky-impalas-clean.md @@ -0,0 +1,5 @@ +--- +"@workflow/web-shared": patch +--- + +Ensure re-running Run from o11y UI will use specified world, instead of inferring from env diff --git a/.changeset/whole-walls-walk.md b/.changeset/whole-walls-walk.md new file mode 100644 index 0000000000..aeee9fb326 --- /dev/null +++ b/.changeset/whole-walls-walk.md @@ -0,0 +1,5 @@ +--- +"@workflow/core": patch +--- + +Allow passing custom world to runtime start() call diff --git a/packages/core/src/runtime/start.ts b/packages/core/src/runtime/start.ts index 687bf012b2..2042afdc2f 100644 --- a/packages/core/src/runtime/start.ts +++ b/packages/core/src/runtime/start.ts @@ -1,7 +1,7 @@ import { waitUntil } from '@vercel/functions'; import { WorkflowRuntimeError } from '@workflow/errors'; import { withResolvers } from '@workflow/utils'; -import type { WorkflowInvokePayload } from '@workflow/world'; +import type { WorkflowInvokePayload, World } from '@workflow/world'; import { Run } from '../runtime.js'; import type { Serializable } from '../schemas.js'; import { dehydrateWorkflowArguments } from '../serialization.js'; @@ -19,6 +19,12 @@ export interface StartOptions { * Only set this if you are doing something advanced and know what you are doing. */ deploymentId?: string; + + /** + * The world to use for the workflow run creation, + * by default the world is inferred from the environment variables. + */ + world?: World; } /** @@ -86,7 +92,7 @@ export async function start( ...Attribute.WorkflowArgumentsCount(args.length), }); - const world = getWorld(); + const world = opts?.world ?? getWorld(); const deploymentId = opts.deploymentId ?? (await world.getDeploymentId()); const ops: Promise[] = []; const { promise: runIdPromise, resolve: resolveRunId } = diff --git a/packages/web-shared/src/api/workflow-server-actions.ts b/packages/web-shared/src/api/workflow-server-actions.ts index 98c1340e83..ff2f161d00 100644 --- a/packages/web-shared/src/api/workflow-server-actions.ts +++ b/packages/web-shared/src/api/workflow-server-actions.ts @@ -842,6 +842,7 @@ export async function recreateRun( hydratedRun.input, { deploymentId, + world, } ); return createResponse(newRun.runId);