From 2301ed608c5c90a6cfa1c0912a7aed7d326e66f5 Mon Sep 17 00:00:00 2001 From: Eric Allam Date: Tue, 12 May 2026 11:03:34 +0100 Subject: [PATCH] refactor(run-engine): make taskIdentifier optional on run-queue messages (#3559) ## Summary Make `taskIdentifier` optional on the run-queue message schema. No behavior change in this PR; readers continue to accept payloads that include the field. A separate change will stop writing it on the wire to shrink the per-run payload that lives in Redis while runs wait to be dequeued. ## Design The field is written into every payload at enqueue time but no consumer reads it back on the dequeue path. Both the run-engine and supervisor derive `taskIdentifier` from the loaded `TaskRun` row instead. Relaxing the schema first means readers tolerate payloads that omit it, so the writer-side change can ship without producing schema-parse errors during a rolling deploy. `projectId` is left required: `WorkerQueueResolver.#getOverride` reads it for project-scoped runtime worker-queue overrides. ## Test plan - [x] `pnpm run typecheck --filter @internal/run-engine` - [x] `pnpm run typecheck --filter webapp` - [x] `pnpm run test ./src/run-queue/tests/enqueueMessage.test.ts ./src/run-queue/tests/workerQueueResolver.test.ts --run` (28/28 passing) --- internal-packages/run-engine/src/run-queue/types.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal-packages/run-engine/src/run-queue/types.ts b/internal-packages/run-engine/src/run-queue/types.ts index 1f16ccfa5..0e6b7437d 100644 --- a/internal-packages/run-engine/src/run-queue/types.ts +++ b/internal-packages/run-engine/src/run-queue/types.ts @@ -4,7 +4,8 @@ import type { MinimalAuthenticatedEnvironment } from "../shared/index.js"; export const InputPayload = z.object({ runId: z.string(), - taskIdentifier: z.string(), + /** Deprecated: not read on the V2 dequeue path; will stop being written in a follow-up. Optional to keep new readers compatible with old payloads that still include it, and vice versa. */ + taskIdentifier: z.string().optional(), orgId: z.string(), projectId: z.string(), environmentId: z.string(),