Skip to content

Commit f434338

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 3854060 commit f434338

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
@@ -613,10 +613,12 @@ export class ClaudeCodeRootRefusalError extends Schema.TaggedError<ClaudeCodeRoo
613613

614614
class ClaudeMcpRegistrationTimeoutError extends Schema.TaggedError<ClaudeMcpRegistrationTimeoutError>()(
615615
"ClaudeMcpRegistrationTimeoutError",
616-
{},
616+
{ phase: Schema.Literals(["initialize", "setMcpServers"]) },
617617
) {
618618
override get message(): string {
619-
return "Claude timed out while registering its MCP tools. Retry the turn; if it keeps failing, check Claude and the server logs.";
619+
return this.phase === "initialize"
620+
? "Claude timed out while starting up. Retry the turn; if it keeps failing, check Claude and the server logs."
621+
: "Claude timed out while registering its MCP tools. Retry the turn; if it keeps failing, check Claude and the server logs.";
620622
}
621623
}
622624

@@ -1285,15 +1287,18 @@ export const layerQueryRunner: Layer.Layer<
12851287
restore(
12861288
Effect.gen(function* () {
12871289
if (mcpServers !== undefined) {
1288-
const timedOut = (method: string) => () =>
1290+
const timedOut = (phase: ClaudeMcpRegistrationTimeoutError["phase"]) => () =>
12891291
Effect.logWarning("orchestration-v2.claude-mcp-registration-timeout", {
12901292
threadId: input.threadId,
12911293
providerSessionId: input.providerSessionId,
1292-
method,
1294+
phase,
12931295
}).pipe(
12941296
Effect.andThen(
12951297
Effect.fail(
1296-
queryRunnerError(new ClaudeMcpRegistrationTimeoutError(), method),
1298+
queryRunnerError(
1299+
new ClaudeMcpRegistrationTimeoutError({ phase }),
1300+
phase,
1301+
),
12971302
),
12981303
),
12991304
);

‎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)