Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tricky-impalas-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@workflow/web-shared": patch
---

Ensure re-running Run from o11y UI will use specified world, instead of inferring from env
5 changes: 5 additions & 0 deletions .changeset/whole-walls-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@workflow/core": patch
---

Allow passing custom world to runtime start() call
10 changes: 8 additions & 2 deletions packages/core/src/runtime/start.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -86,7 +92,7 @@ export async function start<TArgs extends unknown[], TResult>(
...Attribute.WorkflowArgumentsCount(args.length),
});

const world = getWorld();
const world = opts?.world ?? getWorld();
const deploymentId = opts.deploymentId ?? (await world.getDeploymentId());
const ops: Promise<void>[] = [];
const { promise: runIdPromise, resolve: resolveRunId } =
Expand Down
1 change: 1 addition & 0 deletions packages/web-shared/src/api/workflow-server-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,7 @@ export async function recreateRun(
hydratedRun.input,
{
deploymentId,
world,
}
);
return createResponse(newRun.runId);
Expand Down
Loading