diff --git a/internal-packages/run-engine/src/engine/systems/runAttemptSystem.ts b/internal-packages/run-engine/src/engine/systems/runAttemptSystem.ts index ce0f8abe4d..e0d314eee2 100644 --- a/internal-packages/run-engine/src/engine/systems/runAttemptSystem.ts +++ b/internal-packages/run-engine/src/engine/systems/runAttemptSystem.ts @@ -187,6 +187,7 @@ export class RunAttemptSystem { machinePreset: true, runTags: true, isTest: true, + concurrencyKey: true, idempotencyKey: true, startedAt: true, maxAttempts: true, @@ -248,6 +249,7 @@ export class RunAttemptSystem { ]); return { + concurrencyKey: run.concurrencyKey ?? undefined, run: { id: run.friendlyId, tags: run.runTags, diff --git a/packages/core/src/v3/schemas/common.ts b/packages/core/src/v3/schemas/common.ts index 2928995606..f6c2950bbd 100644 --- a/packages/core/src/v3/schemas/common.ts +++ b/packages/core/src/v3/schemas/common.ts @@ -398,6 +398,8 @@ export const V3TaskRunExecution = z.object({ export type V3TaskRunExecution = z.infer; export const TaskRunContext = z.object({ + /** The concurrency key used when triggering this run, if any */ + concurrencyKey: z.string().optional(), attempt: TaskRunExecutionAttempt, run: TaskRun.omit({ payload: true, @@ -420,6 +422,8 @@ export const V3TaskRunExecutionEnvironment = z.object({ export type V3TaskRunExecutionEnvironment = z.infer; export const V3TaskRunContext = z.object({ + /** The concurrency key used when triggering this run, if any */ + concurrencyKey: z.string().optional(), attempt: V3TaskRunExecutionAttempt.omit({ backgroundWorkerId: true, backgroundWorkerTaskId: true,