Skip to content

Commit cfafb4b

Browse files
shivamhwpPR Batch TesterMichel-Liaoclaude
authored
fix(codex): a slow but healthy Codex no longer shows as Unavailable (#15945)
Co-authored-by: PR Batch Tester <[email protected]> Co-authored-by: Michel-Liao <[email protected]> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
1 parent e3b35d1 commit cfafb4b

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

‎apps/server/src/provider/CodexProvider.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import {
3636
import { resolveSpawnCommand } from "@t3tools/shared/shell";
3737
import { codexAppServerArgs, resolveCodexLaunchArgs } from "./codexLaunchArgs.ts";
3838
import {
39-
AUTH_PROBE_TIMEOUT_MS,
4039
buildServerProvider,
4140
COMPACT_SLASH_COMMAND,
4241
providerModelsFromSettings,
@@ -71,6 +70,11 @@ const CODEX_APP_SERVER_PROBE_FORCE_KILL_AFTER = "2 seconds" as const;
7170
const CODEX_CATALOG_REFRESH_TIMEOUT = "3 seconds" as const;
7271
const CODEX_CATALOG_REFRESH_POLL = "100 millis" as const;
7372
const CODEX_CLIENT_NAME = "T3 Code";
73+
// Codex's probe does a full handshake plus account, models, and skills requests, which can
74+
// legitimately run past the shared 10s AUTH_PROBE_TIMEOUT_MS on a loaded or slow machine
75+
// (most often reported on Windows). Give Codex its own longer budget instead of raising the
76+
// timeout for every provider.
77+
const CODEX_AUTH_PROBE_TIMEOUT_MS = 20_000;
7478

7579
const CODEX_PRESENTATION = {
7680
displayName: "Codex",
@@ -660,7 +664,7 @@ export const checkCodexProviderStatus = Effect.fn("checkCodexProviderStatus")(fu
660664
...(managedAuth ? { skipNativeUsage: true } : {}),
661665
}).pipe(
662666
Effect.scoped,
663-
Effect.timeoutOption(Duration.millis(AUTH_PROBE_TIMEOUT_MS)),
667+
Effect.timeoutOption(Duration.millis(CODEX_AUTH_PROBE_TIMEOUT_MS)),
664668
Effect.result,
665669
);
666670

‎apps/server/src/provider/ProviderRegistry.test.ts‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,22 @@ it.layer(
588588
}),
589589
);
590590

591+
it.effect(
592+
"does not time out a healthy probe slower than the shared 10s auth-probe timeout (#7513)",
593+
() =>
594+
Effect.gen(function* () {
595+
const statusFiber = yield* checkCodexProviderStatus(defaultCodexSettings, () =>
596+
Effect.sleep("15 seconds").pipe(Effect.as(makeCodexProbeSnapshot())),
597+
).pipe(Effect.forkChild);
598+
599+
yield* Effect.yieldNow;
600+
yield* TestClock.adjust("15 seconds");
601+
602+
const status = yield* Fiber.join(statusFiber);
603+
assert.strictEqual(status.status, "ready");
604+
}),
605+
);
606+
591607
it.effect("closes the app-server probe scope when provider status times out", () =>
592608
Effect.gen(function* () {
593609
const killCalls = yield* Ref.make(0);
@@ -597,7 +613,7 @@ it.layer(
597613
);
598614

599615
yield* Effect.yieldNow;
600-
yield* TestClock.adjust("11 seconds");
616+
yield* TestClock.adjust("21 seconds");
601617
yield* Effect.yieldNow;
602618

603619
const status = yield* Fiber.join(statusFiber);

0 commit comments

Comments
 (0)