From 70825476041a2a12d48cd5e17e5f2290d85b5acb Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Thu, 27 Aug 2026 01:13:05 -0700 Subject: [PATCH] fix(orchestration): normalize worker-start timeout defaults --- .../orchestration-worker-start-budgets.test.ts | 17 ++++++++++++++++- .../orchestration-worker-start-budgets.ts | 6 ++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main/runtime/rpc/methods/orchestration-worker-start-budgets.test.ts b/src/main/runtime/rpc/methods/orchestration-worker-start-budgets.test.ts index 51833d06f4d..6e600dd5177 100644 --- a/src/main/runtime/rpc/methods/orchestration-worker-start-budgets.test.ts +++ b/src/main/runtime/rpc/methods/orchestration-worker-start-budgets.test.ts @@ -1,6 +1,9 @@ import { describe, expect, it } from 'vitest' import { MAX_TIMER_DELAY_MS } from '../../../../shared/timer-delay' -import { ORCHESTRATION_WORKER_START_CLIENT_GRACE_MS } from '../../../../shared/orchestration-timing-budgets' +import { + ORCHESTRATION_READINESS_TIMEOUT_MS, + ORCHESTRATION_WORKER_START_CLIENT_GRACE_MS +} from '../../../../shared/orchestration-timing-budgets' import { resolveFederatedWorkerStartBudgets } from './orchestration-worker-start-budgets' describe('worker-start transport budgets', () => { @@ -16,4 +19,16 @@ describe('worker-start transport budgets', () => { 'derived timeout must fit' ) }) + + it('normalizes non-positive requests to the ordinary readiness default', () => { + const expectedOuterDeadline = + 1_000 + ORCHESTRATION_READINESS_TIMEOUT_MS + ORCHESTRATION_WORKER_START_CLIENT_GRACE_MS + expect(resolveFederatedWorkerStartBudgets(0, 1_000).readinessTimeoutMs).toBe( + ORCHESTRATION_READINESS_TIMEOUT_MS + ) + expect(resolveFederatedWorkerStartBudgets(0, 1_000).outerDeadlineMs).toBe(expectedOuterDeadline) + expect(resolveFederatedWorkerStartBudgets(-1, 1_000).outerDeadlineMs).toBe( + expectedOuterDeadline + ) + }) }) diff --git a/src/main/runtime/rpc/methods/orchestration-worker-start-budgets.ts b/src/main/runtime/rpc/methods/orchestration-worker-start-budgets.ts index 5e54d9da1c7..de5f3db40d9 100644 --- a/src/main/runtime/rpc/methods/orchestration-worker-start-budgets.ts +++ b/src/main/runtime/rpc/methods/orchestration-worker-start-budgets.ts @@ -1,8 +1,8 @@ import { ORCHESTRATION_CONTRACT_PREFLIGHT_TIMEOUT_MS, - ORCHESTRATION_READINESS_TIMEOUT_MS, isWorkerStartTimeoutWithinTimerLimit, resolveFederationAttachDeadlineMs, + resolveWorkerStartReadinessTimeoutMs, resolveWorkerStartClientTimeoutMs } from '../../../../shared/orchestration-timing-budgets' @@ -15,7 +15,9 @@ export function resolveFederatedWorkerStartBudgets( '--timeout-ms is too large for worker-start transport grace; the derived timeout must fit within the timer limit.' ) } - const readinessTimeoutMs = timeoutMs ?? ORCHESTRATION_READINESS_TIMEOUT_MS + // Normalize non-positive/invalid values exactly as the client does so local + // and federated transports share the ordinary default contract. + const readinessTimeoutMs = resolveWorkerStartReadinessTimeoutMs(timeoutMs) const outerDeadlineMs = nowMs + resolveWorkerStartClientTimeoutMs(readinessTimeoutMs) return { readinessTimeoutMs,