Skip to content

Commit 8afe10b

Browse files
chief-archivistclaude
authored andcommitted
fix(server): a Claude boot timeout says Claude timed out starting up
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 2611c2c commit 8afe10b

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -615,10 +615,12 @@ export class ClaudeCodeRootRefusalError extends Schema.TaggedError<ClaudeCodeRoo
615615

616616
class ClaudeMcpRegistrationTimeoutError extends Schema.TaggedError<ClaudeMcpRegistrationTimeoutError>()(
617617
"ClaudeMcpRegistrationTimeoutError",
618-
{},
618+
{ phase: Schema.Literals(["initialize", "setMcpServers"]) },
619619
) {
620620
override get message(): string {
621-
return "Claude timed out while registering its MCP tools. Retry the turn; if it keeps failing, check Claude and the server logs.";
621+
return this.phase === "initialize"
622+
? "Claude timed out while starting up. Retry the turn; if it keeps failing, check Claude and the server logs."
623+
: "Claude timed out while registering its MCP tools. Retry the turn; if it keeps failing, check Claude and the server logs.";
622624
}
623625
}
624626

@@ -1287,15 +1289,18 @@ export const layerQueryRunner: Layer.Layer<
12871289
restore(
12881290
Effect.gen(function* () {
12891291
if (mcpServers !== undefined) {
1290-
const timedOut = (method: string) => () =>
1292+
const timedOut = (phase: ClaudeMcpRegistrationTimeoutError["phase"]) => () =>
12911293
Effect.logWarning("orchestration-v2.claude-mcp-registration-timeout", {
12921294
threadId: input.threadId,
12931295
providerSessionId: input.providerSessionId,
1294-
method,
1296+
phase,
12951297
}).pipe(
12961298
Effect.andThen(
12971299
Effect.fail(
1298-
queryRunnerError(new ClaudeMcpRegistrationTimeoutError(), method),
1300+
queryRunnerError(
1301+
new ClaudeMcpRegistrationTimeoutError({ phase }),
1302+
phase,
1303+
),
12991304
),
13001305
),
13011306
);

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,13 @@ it.effect.each([
550550

551551
assert.equal(result._tag, boots ? "Success" : "Failure");
552552
if (result._tag === "Success") yield* result.success.close;
553+
else
554+
assert.equal(
555+
makeProviderFailure({
556+
cause: { _tag: "ProviderAdapterTurnStartError", cause: result.failure },
557+
}).message,
558+
"Claude timed out while starting up. Retry the turn; if it keeps failing, check Claude and the server logs.",
559+
);
553560
}).pipe(Effect.provide(realQueryRunner)),
554561
),
555562
);

0 commit comments

Comments
 (0)