diff --git a/src/main/runtime/rpc/methods/orchestration-federated-worker-start.ts b/src/main/runtime/rpc/methods/orchestration-federated-worker-start.ts index 341fa08f1d6..0f6bd44f67f 100644 --- a/src/main/runtime/rpc/methods/orchestration-federated-worker-start.ts +++ b/src/main/runtime/rpc/methods/orchestration-federated-worker-start.ts @@ -124,7 +124,7 @@ export async function startFederatedWorker(args: { terminal: params.terminal ?? null, agent: params.agent ?? null, launch: requestedLaunch, - timeoutMs: params.timeoutMs ?? 60_000, + timeoutMs: budgets.readinessTimeoutMs, setup: setupDecision, setupSource: createsWorktree ? params.setup @@ -171,7 +171,7 @@ export async function startFederatedWorker(args: { agent: params.agent, model: params.model, effort: params.effort, - timeoutMs: params.timeoutMs, + timeoutMs: budgets.readinessTimeoutMs, devMode: params.devMode }, budgets.attachDeadlineMs, @@ -217,7 +217,7 @@ export async function startFederatedWorker(args: { server: { environmentId: server.environmentId, name: server.name }, setup: remote.setup, launch, - timeoutMs: params.timeoutMs ?? 60_000, + timeoutMs: budgets.readinessTimeoutMs, effects: remote.effects ?? [], residualResources: remote.residualResources ?? [] } diff --git a/src/main/runtime/rpc/methods/orchestration-workers.ts b/src/main/runtime/rpc/methods/orchestration-workers.ts index 078c3e3542b..61271525939 100644 --- a/src/main/runtime/rpc/methods/orchestration-workers.ts +++ b/src/main/runtime/rpc/methods/orchestration-workers.ts @@ -22,7 +22,10 @@ import { failWorkerStartWithReceipt } from './orchestration-worker-start-receipt import { prepareLocalWorkerStart } from './orchestration-worker-start-validation' import { resolveDispatchCreator } from './orchestration-dispatch-creator' import { resolveOrchestrationCaller } from './orchestration-run-scope' -import { isWorkerStartTimeoutWithinTimerLimit } from '../../../../shared/orchestration-timing-budgets' +import { + isWorkerStartTimeoutWithinTimerLimit, + resolveWorkerStartReadinessTimeoutMs +} from '../../../../shared/orchestration-timing-budgets' export const ORCHESTRATION_WORKER_START_METHODS: RpcMethod[] = [ defineMethod({ @@ -38,6 +41,7 @@ export const ORCHESTRATION_WORKER_START_METHODS: RpcMethod[] = [ `--timeout-ms is too large for worker-start transport grace; the derived timeout must fit within the timer limit.` ) } + const readinessTimeoutMs = resolveWorkerStartReadinessTimeoutMs(params.timeoutMs) const db = runtime.getOrchestrationDb() // Why: worker-start was the only Run-scoped verb that skipped this, so a // declared --from could name someone else's pane and inherit their depth. @@ -118,7 +122,7 @@ export const ORCHESTRATION_WORKER_START_METHODS: RpcMethod[] = [ terminal: params.terminal ?? null, agent: agent ?? null, launch: launch.receipt, - timeoutMs: params.timeoutMs ?? 60_000, + timeoutMs: readinessTimeoutMs, setup: createsWorktree ? (params.setup ?? 'run') : 'not_applicable', setupSource: createsWorktree ? params.setup @@ -215,7 +219,7 @@ export const ORCHESTRATION_WORKER_START_METHODS: RpcMethod[] = [ failedStage = 'agent_readiness' const wait = await runtime.waitForTerminal(terminalHandle, { condition: 'tui-idle', - timeoutMs: params.timeoutMs ?? 60_000 + timeoutMs: readinessTimeoutMs }) persistWorkerSetupWaitOutcome({ ...setupStage, wait }) if (!wait.satisfied) { @@ -275,7 +279,7 @@ export const ORCHESTRATION_WORKER_START_METHODS: RpcMethod[] = [ stage: worker.stage, setup: setupReceipt, launch: launch.receipt, - timeoutMs: params.timeoutMs ?? 60_000, + timeoutMs: readinessTimeoutMs, effects, residualResources: [], ...(terminalRevealWarning ? { warning: terminalRevealWarning } : {})