Skip to content

Commit 913dfa8

Browse files
fix(server): give Claude boot room for SessionStart hooks up to their timeout
SessionStart hooks run before the CLI answers initialize, so they count against the boot deadline, not MCP registration. Measured with SDK 0.3.321: a 75 s hook delayed initializationResult() by 75 s and mcp_set_servers was answered 0.1 s later. Keep registration at 90 s and raise boot from 5 to 11 minutes to cover Claude Code's 10 minute hook timeout. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent b58ea83 commit 913dfa8

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,9 @@ export const CLAUDE_DEFAULT_INSTANCE_ID = defaultInstanceIdForDriver(CLAUDE_PROV
350350
const CLAUDE_SCRIPT_EXTENSIONS = [".js", ".mjs", ".tsx", ".ts", ".jsx"];
351351
// The SDK has no control-request deadline; the CLI waits up to 30 s per MCP server.
352352
const CLAUDE_MCP_REGISTRATION_TIMEOUT = "90 seconds";
353-
const CLAUDE_BOOT_TIMEOUT = "5 minutes";
353+
// Boot includes SessionStart hooks, which Claude Code runs to its 10 minute hook
354+
// timeout before it answers initialize.
355+
const CLAUDE_BOOT_TIMEOUT = "11 minutes";
354356
// Claude can consume a subagent result before the launching turn ends, leaving
355357
// its notification with no native wake turn to answer the continuation.
356358
const CLAUDE_WAKE_TURN_START_DEADLINE = "2 minutes";

‎apps/server/src/orchestration-v2/Adapters/ClaudeAgentSdkQueryRunner.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,8 @@ it.effect("does not reuse a fresh session ID after MCP registration times out",
500500

501501
it.effect.each([
502502
["opens after a slow CLI boot", "120 seconds", true],
503-
["times out a CLI that never boots", "5 minutes", false],
503+
["opens after SessionStart hooks run near their 10 minute timeout", "10 minutes", true],
504+
["times out a CLI that never boots", "11 minutes", false],
504505
] as const)("%s", ([, bootWait, boots]) =>
505506
Effect.gen(function* () {
506507
const waiting = Promise.withResolvers<void>();

0 commit comments

Comments
 (0)