GeezerVison is showing github.com — fix(server): give Codex's provider probe its own longer timeout · pingdotgg/t3code@4ba0f51
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/server/src/provider/CodexProvider.ts +6-2Lines changed: 6 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -36,7 +36,6 @@ import { | 36 | 36 | import { resolveSpawnCommand } from "@t3tools/shared/shell"; | 37 | 37 | import { codexAppServerArgs, resolveCodexLaunchArgs } from "./codexLaunchArgs.ts"; | 38 | 38 | import { | 39 | | - AUTH_PROBE_TIMEOUT_MS, | 40 | 39 | buildServerProvider, | 41 | 40 | COMPACT_SLASH_COMMAND, | 42 | 41 | providerModelsFromSettings, | @@ -72,6 +71,11 @@ const CODEX_APP_SERVER_PROBE_FORCE_KILL_AFTER = "2 seconds" as const; | 72 | 71 | const CODEX_CATALOG_REFRESH_TIMEOUT = "3 seconds" as const; | 73 | 72 | const CODEX_CATALOG_REFRESH_POLL = "100 millis" as const; | 74 | 73 | const CODEX_CLIENT_NAME = "T3 Code"; | | 74 | +// Codex's probe does a full handshake plus account, models, and skills requests, which can | | 75 | +// legitimately run past the shared 10s AUTH_PROBE_TIMEOUT_MS on a loaded or slow machine | | 76 | +// (most often reported on Windows). Give Codex its own longer budget instead of raising the | | 77 | +// timeout for every provider. | | 78 | +const CODEX_AUTH_PROBE_TIMEOUT_MS = 20_000; | 75 | 79 |
| 76 | 80 | const CODEX_PRESENTATION = { | 77 | 81 | displayName: "Codex", | @@ -690,7 +694,7 @@ export const checkCodexProviderStatus = Effect.fn("checkCodexProviderStatus")(fu | 690 | 694 | ...(managedAuth ? { skipNativeUsage: true } : {}), | 691 | 695 | }).pipe( | 692 | 696 | Effect.scoped, | 693 | | - Effect.timeoutOption(Duration.millis(AUTH_PROBE_TIMEOUT_MS)), | | 697 | + Effect.timeoutOption(Duration.millis(CODEX_AUTH_PROBE_TIMEOUT_MS)), | 694 | 698 | Effect.result, | 695 | 699 | ); | 696 | 700 |
| |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/provider/ProviderRegistry.test.ts +17-1Lines changed: 17 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -596,6 +596,22 @@ it.layer( | 596 | 596 | }), | 597 | 597 | ); | 598 | 598 |
| | 599 | + it.effect( | | 600 | + "does not time out a healthy probe slower than the shared 10s auth-probe timeout (#7513)", | | 601 | + () => | | 602 | + Effect.gen(function* () { | | 603 | + const statusFiber = yield* checkCodexProviderStatus(defaultCodexSettings, () => | | 604 | + Effect.sleep("15 seconds").pipe(Effect.as(makeCodexProbeSnapshot())), | | 605 | + ).pipe(Effect.forkChild); | | 606 | + | | 607 | + yield* Effect.yieldNow; | | 608 | + yield* TestClock.adjust("15 seconds"); | | 609 | + | | 610 | + const status = yield* Fiber.join(statusFiber); | | 611 | + assert.strictEqual(status.status, "ready"); | | 612 | + }), | | 613 | + ); | | 614 | + | 599 | 615 | it.effect("closes the app-server probe scope when provider status times out", () => | 600 | 616 | Effect.gen(function* () { | 601 | 617 | const killCalls = yield* Ref.make(0); | @@ -605,7 +621,7 @@ it.layer( | 605 | 621 | ); | 606 | 622 |
| 607 | 623 | yield* Effect.yieldNow; | 608 | | - yield* TestClock.adjust("11 seconds"); | | 624 | + yield* TestClock.adjust("21 seconds"); | 609 | 625 | yield* Effect.yieldNow; | 610 | 626 |
| 611 | 627 | const status = yield* Fiber.join(statusFiber); | |
|