The best way to control Claude Code, Codex and more from any computer or phone
fix(server): a slow Claude CLI is no longer reported as failing to run (#21263)
Co-authored-by: Yaacov <corcos.yaacov@mail.huji.ac.il> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
yaacovcorcos committed
Oct 20, 2026 at 07:17 UTC
5932c193a00a0e6f2ee634bdfc460b53f68e354a
2 files changed
+63
-1
apps/server/src/provider/ClaudeProvider.ts
+3
-1
@@ -194,6 +194,8 @@ function claudeAuthStatus(
194
// Amazon Bedrock initializes far slower than first-party auth: the SDK boots the Bedrock
195
// backend and runs the `awsAuthRefresh` credential hook before returning account info.
196
const CAPABILITIES_PROBE_TIMEOUT_MS = 25_000;
197
+// Native CLI startup on Windows can exceed the shared probe deadline.
198
+const CLAUDE_VERSION_CHECK_TIMEOUT_MS = 20_000;
199
200
export const CLAUDE_CAPABILITIES_PROBE_SETTING_SOURCES = [
201
"user",
@@ -514,7 +516,7 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")(
516
["--version"],
517
resolvedEnvironment,
518
cwd,
517
- ).pipe(Effect.timeoutOption(DEFAULT_TIMEOUT_MS), Effect.result);
519
+ ).pipe(Effect.timeoutOption(CLAUDE_VERSION_CHECK_TIMEOUT_MS), Effect.result);
520
521
if (Result.isFailure(versionProbe)) {
522
const error = versionProbe.failure;
apps/server/src/provider/ProviderRegistry.test.ts
+60
@@ -4007,6 +4007,66 @@ it.layer(
4007
),
4008
);
4009
4010
+ it.effect.each([
4011
+ {
4012
+ name: "accepts a healthy claude --version response after 19 seconds",
4013
+ answer: Effect.sleep("19 seconds"),
4014
+ elapsed: 19_000,
4015
+ status: "ready",
4016
+ version: "1.0.0",
4017
+ },
4018
+ {
4019
+ name: "bounds a hung claude --version probe",
4020
+ answer: Effect.never,
4021
+ elapsed: 21_000,
4022
+ status: "error",
4023
+ version: null,
4024
+ },
4025
+ ])("$name", ({ answer, elapsed, status: expectedStatus, version }) =>
4026
+ Effect.gen(function* () {
4027
+ const started = yield* Deferred.make<void>();
4028
+ const statusFiber = yield* checkClaudeProviderStatus(
4029
+ defaultClaudeSettings,
4030
+ claudeCapabilities(),
4031
+ ).pipe(
4032
+ Effect.provide(
4033
+ Layer.succeed(
4034
+ ChildProcessSpawner.ChildProcessSpawner,
4035
+ ChildProcessSpawner.make((command) => {
4036
+ assert.deepStrictEqual(
4037
+ (command as unknown as { args: ReadonlyArray<string> }).args,
4038
+ ["--version"],
4039
+ );
4040
+ return Effect.succeed(
4041
+ ChildProcessSpawner.makeHandle({
4042
+ ...mockHandle({ stdout: "", stderr: "", code: 0 }),
4043
+ exitCode: answer.pipe(Effect.as(ChildProcessSpawner.ExitCode(0))),
4044
+ stdout: Stream.fromEffect(
4045
+ Deferred.succeed(started, undefined).pipe(
4046
+ Effect.andThen(answer),
4047
+ Effect.as(encoder.encode("1.0.0\n")),
4048
+ ),
4049
+ ),
4050
+ }),
4051
+ );
4052
+ }),
4053
+ ),
4054
+ ),
4055
+ Effect.forkChild,
4056
+ );
4057
+ yield* Deferred.await(started);
4058
+ yield* TestClock.adjust(elapsed);
4059
+
4060
+ const status = yield* Fiber.join(statusFiber);
4061
+ assert.strictEqual(status.status, expectedStatus);
4062
+ assert.strictEqual(status.installed, true);
4063
+ assert.strictEqual(status.version, version);
4064
+ if (expectedStatus === "error") {
4065
+ assert.include(status.message, "Timed out while running command.");
4066
+ }
4067
+ }),
4068
+ );
4069
+
4070
it.effect("returns ready and labels Bedrock-backed Claude as authenticated", () =>
4071
Effect.gen(function* () {
4072
// Bedrock authenticates via external AWS credentials, so the SDK init