From d22b2aa0060162dcb78b738495031a74789936c2 Mon Sep 17 00:00:00 2001 From: Victor Vogel Date: Sat, 31 Oct 2026 21:42:57 +0000 Subject: [PATCH 1/3] fix(providers): Grok, Pi and fx version probes get the 10 s budget OpenCode uses Grok, Pi and fx gave ` --version` only 4 s, so a slow Node cold start behind a shim, version manager or Windows job object made the provider show as unavailable until a manual refresh. The `--version` probe now gets 10 s in each, matching OpenCode (#16544). fx gets its own constant instead of the shared DEFAULT_TIMEOUT_MS. Pi's `pi auth check` keeps its 4 s deadline through DEFAULT_TIMEOUT_MS. Tests on the test clock cover a `--version` that answers after 6 s and one that never answers and still times out by 10 s. Co-Authored-By: Claude Opus 5.5 --- apps/server/src/provider/GrokProvider.test.ts | 67 +++++++++++++++++++ .../provider-fx/src/server/status.test.ts | 40 ++++++++++- packages/provider-fx/src/server/status.ts | 5 +- packages/provider-grok/src/server/status.ts | 2 +- .../provider-pi/src/server/status.test.ts | 42 ++++++++++++ packages/provider-pi/src/server/status.ts | 5 +- 6 files changed, 154 insertions(+), 7 deletions(-) diff --git a/apps/server/src/provider/GrokProvider.test.ts b/apps/server/src/provider/GrokProvider.test.ts index 4ecc0ad28971b..8869cc09a65dc 100644 --- a/apps/server/src/provider/GrokProvider.test.ts +++ b/apps/server/src/provider/GrokProvider.test.ts @@ -5,9 +5,16 @@ import * as NodeURL from "node:url"; import * as NodeServices from "@effect/platform-node/NodeServices"; import { describe, expect, it } from "@effect/vitest"; import * as Effect from "effect/Effect"; +import * as Fiber from "effect/Fiber"; import * as FileSystem from "effect/FileSystem"; +import * as PlatformError from "effect/PlatformError"; import * as Schema from "effect/Schema"; +import * as Sink from "effect/Sink"; +import * as Stream from "effect/Stream"; import { HttpClient, HttpClientResponse } from "effect/http"; +import * as ChildProcess from "effect/process/ChildProcess"; +import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner"; +import * as TestClock from "effect/testing/TestClock"; import { GrokSettings } from "@t3tools/provider-grok/settings"; import { @@ -221,6 +228,66 @@ it.layer(NodeServices.layer)("checkGrokProviderStatus", (it) => { }), ); + it.effect.each([ + { + label: "answers after 6 s", + versionDelay: "6 seconds", + version: "1.0.52", + message: "Grok CLI is installed but ACP initialize failed. Model options may be incomplete.", + probesAfterVersion: true, + }, + { + label: "never answers", + versionDelay: "Infinity", + version: null, + message: "Grok CLI is installed but timed out while running `grok --version`.", + probesAfterVersion: false, + }, + ] as const)("gives `grok --version` 10 s when it $label", (row) => + Effect.gen(function* () { + // A fake CLI runs on wall time, so a stub answers `--version` on the test clock. + const spawned: Array = []; + const spawner = ChildProcessSpawner.make((command) => { + const args = ChildProcess.isStandardCommand(command) ? command.args : []; + spawned.push(args.join(" ")); + if (!args.includes("--version")) { + return Effect.fail( + PlatformError.systemError({ + _tag: "PermissionDenied", + module: "ChildProcess", + method: "spawn", + description: "Only `grok --version` is stubbed.", + }), + ); + } + const handle = ChildProcessSpawner.makeHandle({ + pid: ChildProcessSpawner.ProcessId(900_000_201), + exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(0)), + isRunning: Effect.succeed(false), + kill: () => Effect.void, + unref: Effect.succeed(Effect.void), + stdin: Sink.drain, + stdout: Stream.encodeText(Stream.make("grok 1.0.52\n")), + stderr: Stream.empty, + all: Stream.empty, + getInputFd: () => Sink.drain, + getOutputFd: () => Stream.empty, + }); + return Effect.delay(Effect.succeed(handle), row.versionDelay); + }); + const fiber = yield* checkGrokProviderStatus(decodeGrokSettings({ enabled: true }), {}).pipe( + Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), + Effect.forkChild, + ); + yield* TestClock.adjust("10 seconds"); + const snapshot = yield* Fiber.join(fiber); + expect(snapshot.installed).toBe(true); + expect(snapshot.version).toBe(row.version); + expect(snapshot.message).toBe(row.message); + expect(spawned.length > 1).toBe(row.probesAfterVersion); + }), + ); + // A stand-in for the Grok CLI: `--version` and `models` print canned text, // and `agent stdio` execs the mock ACP agent so `initialize` returns model metadata. // A list of `models` outputs is served in call order, repeating the last one. diff --git a/packages/provider-fx/src/server/status.test.ts b/packages/provider-fx/src/server/status.test.ts index a235340a49e21..149dd2186dcb5 100644 --- a/packages/provider-fx/src/server/status.test.ts +++ b/packages/provider-fx/src/server/status.test.ts @@ -1,11 +1,14 @@ import * as NodeServices from "@effect/platform-node/NodeServices"; import { assert, describe, it } from "@effect/vitest"; +import type * as Duration from "effect/Duration"; import * as Effect from "effect/Effect"; +import * as Fiber from "effect/Fiber"; import * as Schema from "effect/Schema"; import * as Sink from "effect/Sink"; import * as Stream from "effect/Stream"; import * as ChildProcess from "effect/process/ChildProcess"; import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner"; +import * as TestClock from "effect/testing/TestClock"; import { FxSettings } from "../settings.ts"; import { checkFxProviderStatus } from "./status.ts"; @@ -30,7 +33,7 @@ function processHandle(stdout: string, code: number) { } /** Answers `fx` invocations by their arguments and records which ran. */ -const check = (statusJson: string) => +const check = (statusJson: string, versionDelay: Duration.Input = 0) => Effect.gen(function* () { const outputs: Record = { "--version": "fx 0.0.13\n", @@ -50,7 +53,8 @@ const check = (statusJson: string) => const args = ChildProcess.isStandardCommand(command) ? command.args.join(" ") : ""; invoked.push(args); const stdout = outputs[args]; - return Effect.succeed(processHandle(stdout ?? "", stdout === undefined ? 2 : 0)); + const handle = Effect.succeed(processHandle(stdout ?? "", stdout === undefined ? 2 : 0)); + return args === "--version" ? Effect.delay(handle, versionDelay) : handle; }); const draft = yield* checkFxProviderStatus(settings, {}).pipe( Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), @@ -59,6 +63,38 @@ const check = (statusJson: string) => }).pipe(Effect.provide(NodeServices.layer)); describe("checkFxProviderStatus", () => { + it.effect.each([ + { + label: "answers after 6 s", + versionDelay: "6 seconds", + status: "ready", + version: "0.0.13", + message: undefined, + invoked: ["--version", "status --json", "models --json"], + }, + { + label: "never answers", + versionDelay: "Infinity", + status: "error", + version: null, + message: "Failed to run `fx --version`.", + invoked: ["--version"], + }, + ] as const)("gives `fx --version` 10 s when it $label", (row) => + Effect.gen(function* () { + const fiber = yield* check( + JSON.stringify({ kind: "status", model: "anthropic/claude-opus-5.5", auth: "fx login" }), + row.versionDelay, + ).pipe(Effect.forkChild); + yield* TestClock.adjust("10 seconds"); + const { draft, invoked } = yield* Fiber.join(fiber); + assert.equal(draft.status, row.status); + assert.equal(draft.version, row.version); + assert.equal(draft.message, row.message); + assert.deepEqual(invoked, [...row.invoked]); + }), + ); + // `fx status --json` from fx 0.0.13, trimmed to the fields T3 reads plus a few it ignores. it.effect("reports sign-in from `fx status` without opening an ACP session", () => Effect.gen(function* () { diff --git a/packages/provider-fx/src/server/status.ts b/packages/provider-fx/src/server/status.ts index ec8ad5bce9f8e..c71e909197df2 100644 --- a/packages/provider-fx/src/server/status.ts +++ b/packages/provider-fx/src/server/status.ts @@ -19,7 +19,6 @@ import { import { AUTH_PROBE_TIMEOUT_MS, buildServerProvider, - DEFAULT_TIMEOUT_MS, isCommandMissingCause, nonEmptyTrimmed, parseGenericCliVersion, @@ -135,6 +134,8 @@ const FxModels = Schema.fromJsonString( ); const decodeFxModels = Schema.decodeUnknownOption(FxModels); +const VERSION_PROBE_TIMEOUT_MS = 10_000; + function fxAuth(auth: string | undefined): ServerProviderAuth { const method = nonEmptyTrimmed(auth); if (method === undefined) return { status: "unknown" }; @@ -163,7 +164,7 @@ export const checkFxProviderStatus = Effect.fn("checkFxProviderStatus")(function } const versionResult = yield* runFxCli(settings, ["--version"], environment).pipe( - Effect.timeoutOption(DEFAULT_TIMEOUT_MS), + Effect.timeoutOption(VERSION_PROBE_TIMEOUT_MS), Effect.result, ); if (Result.isFailure(versionResult) || Option.isNone(versionResult.success)) { diff --git a/packages/provider-grok/src/server/status.ts b/packages/provider-grok/src/server/status.ts index c634c5b80c74e..cd6e4f3b4fe48 100644 --- a/packages/provider-grok/src/server/status.ts +++ b/packages/provider-grok/src/server/status.ts @@ -58,7 +58,7 @@ const EMPTY_CAPABILITIES: ModelCapabilities = createModelCapabilities({ optionDescriptors: [], }); -const VERSION_PROBE_TIMEOUT_MS = 4_000; +const VERSION_PROBE_TIMEOUT_MS = 10_000; // Grok writes the initialize result only after startup work (settings, // skill discovery, file watching). From a home directory that work measured // 9-14s on CLI 1.0.52, so an 8s cap records a healthy CLI as a failed probe. diff --git a/packages/provider-pi/src/server/status.test.ts b/packages/provider-pi/src/server/status.test.ts index b8559d1ab7d8a..1be07e55d8e7f 100644 --- a/packages/provider-pi/src/server/status.test.ts +++ b/packages/provider-pi/src/server/status.test.ts @@ -8,6 +8,8 @@ import * as Sink from "effect/Sink"; import * as Stream from "effect/Stream"; import * as ChildProcess from "effect/process/ChildProcess"; import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner"; +import * as Fiber from "effect/Fiber"; +import * as TestClock from "effect/testing/TestClock"; import { checkPiProviderStatus, MINIMUM_PI_VERSION } from "./status.ts"; @@ -148,6 +150,46 @@ describe("PiProvider", () => { }).pipe(Effect.provide(NodeServices.layer)), ); + it.effect.each([ + { + label: "answers after 6 s", + versionDelay: "6 seconds", + status: "ready", + version: "0.84.3", + message: "could not refresh its models and commands", + probesAfterVersion: true, + }, + { + label: "never answers", + versionDelay: "Infinity", + status: "error", + version: null, + message: "Pi CLI is installed but timed out while running `pi --version`.", + probesAfterVersion: false, + }, + ] as const)("gives `pi --version` 10 s when it $label", (row) => + Effect.gen(function* () { + const spawned: Array = []; + const spawner = ChildProcessSpawner.make((command) => { + const args = ChildProcess.isStandardCommand(command) ? command.args : []; + spawned.push(args.join(" ")); + return args.includes("--version") + ? Effect.delay(Effect.succeed(processHandle({ stdout: "pi 0.84.3\n" })), row.versionDelay) + : Effect.succeed(processHandle({ stderr: "RPC startup failed", exitCode: 1 })); + }); + const fiber = yield* checkPiProviderStatus(settings).pipe( + Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), + Effect.forkChild, + ); + yield* TestClock.adjust("10 seconds"); + const snapshot = yield* Fiber.join(fiber); + assert.equal(snapshot.status, row.status); + assert.equal(snapshot.version, row.version); + assert.include(snapshot.message ?? "", row.message); + assert.equal(spawned.length > 1, row.probesAfterVersion); + }).pipe(Effect.provide(NodeServices.layer)), + ); + it.effect("reports a known unauthenticated inventory when Pi returns no usable models", () => Effect.gen(function* () { const spawner = yield* piDiscoverySpawner({ models: [] }); diff --git a/packages/provider-pi/src/server/status.ts b/packages/provider-pi/src/server/status.ts index a180ab9c41a3b..dfafa75ccd579 100644 --- a/packages/provider-pi/src/server/status.ts +++ b/packages/provider-pi/src/server/status.ts @@ -29,6 +29,7 @@ import { import * as ProviderLatestVersions from "@t3tools/provider-core/server/ProviderLatestVersions"; import { buildServerProvider, + DEFAULT_TIMEOUT_MS, isCommandMissingCause, parseGenericCliVersion, providerModelsFromSettings, @@ -56,7 +57,7 @@ const PI_PRESENTATION = { reportsContextWindow: true, } as const; -const VERSION_PROBE_TIMEOUT_MS = 4_000; +const VERSION_PROBE_TIMEOUT_MS = 10_000; const PI_RPC_DISCOVERY_TIMEOUT_MS = 30_000; /** * get_entries arrived in 0.80.3 and agent_settled landed in source at 0.80.4. @@ -278,7 +279,7 @@ const describeUnavailablePiModel = Effect.fn("PiProviderStatus.describeUnavailab }), ), ), - Effect.timeout(VERSION_PROBE_TIMEOUT_MS), + Effect.timeout(DEFAULT_TIMEOUT_MS), Effect.option, ); const missingCredentials = Option.exists( From 8a0e48a3df61f81d0d36ae50355a6b4e871afed8 Mon Sep 17 00:00:00 2001 From: Victor Vogel Date: Sat, 31 Oct 2026 23:15:27 +0000 Subject: [PATCH 2/3] test(providers): time out a running CLI, not only a slow spawn The version-probe tests delayed process creation, so a timeout scoped to the spawn alone would still pass. Pi and Grok now spawn at once and hold back `--version` output and exit; fx adds a row for a CLI that starts but never answers. Co-Authored-By: Claude Opus 5.5 --- apps/server/src/provider/GrokProvider.test.ts | 10 +++--- .../provider-fx/src/server/status.test.ts | 34 +++++++++++++++---- .../provider-pi/src/server/status.test.ts | 15 +++++--- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/apps/server/src/provider/GrokProvider.test.ts b/apps/server/src/provider/GrokProvider.test.ts index 8869cc09a65dc..96771b3e46699 100644 --- a/apps/server/src/provider/GrokProvider.test.ts +++ b/apps/server/src/provider/GrokProvider.test.ts @@ -262,18 +262,20 @@ it.layer(NodeServices.layer)("checkGrokProviderStatus", (it) => { } const handle = ChildProcessSpawner.makeHandle({ pid: ChildProcessSpawner.ProcessId(900_000_201), - exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(0)), - isRunning: Effect.succeed(false), + exitCode: Effect.delay(Effect.succeed(ChildProcessSpawner.ExitCode(0)), row.versionDelay), + isRunning: Effect.succeed(true), kill: () => Effect.void, unref: Effect.succeed(Effect.void), stdin: Sink.drain, - stdout: Stream.encodeText(Stream.make("grok 1.0.52\n")), + stdout: Stream.encodeText( + Stream.fromEffect(Effect.delay(Effect.succeed("grok 1.0.52\n"), row.versionDelay)), + ), stderr: Stream.empty, all: Stream.empty, getInputFd: () => Sink.drain, getOutputFd: () => Stream.empty, }); - return Effect.delay(Effect.succeed(handle), row.versionDelay); + return Effect.succeed(handle); }); const fiber = yield* checkGrokProviderStatus(decodeGrokSettings({ enabled: true }), {}).pipe( Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), diff --git a/packages/provider-fx/src/server/status.test.ts b/packages/provider-fx/src/server/status.test.ts index 149dd2186dcb5..79ba8951d2a69 100644 --- a/packages/provider-fx/src/server/status.test.ts +++ b/packages/provider-fx/src/server/status.test.ts @@ -16,15 +16,20 @@ import { checkFxProviderStatus } from "./status.ts"; const encoder = new TextEncoder(); const settings = Schema.decodeSync(FxSettings)({ enabled: true }); -function processHandle(stdout: string, code: number) { +/** A `stalled` process has started but never writes output or exits. */ +function processHandle(stdout: string, code: number, stalled = false) { return ChildProcessSpawner.makeHandle({ pid: ChildProcessSpawner.ProcessId(900_000_101), - exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(code)), + exitCode: stalled ? Effect.never : Effect.succeed(ChildProcessSpawner.ExitCode(code)), isRunning: Effect.succeed(false), kill: () => Effect.void, unref: Effect.succeed(Effect.void), stdin: Sink.drain, - stdout: stdout.length === 0 ? Stream.empty : Stream.succeed(encoder.encode(stdout)), + stdout: stalled + ? Stream.never + : stdout.length === 0 + ? Stream.empty + : Stream.succeed(encoder.encode(stdout)), stderr: Stream.empty, all: Stream.empty, getInputFd: () => Sink.drain, @@ -33,7 +38,7 @@ function processHandle(stdout: string, code: number) { } /** Answers `fx` invocations by their arguments and records which ran. */ -const check = (statusJson: string, versionDelay: Duration.Input = 0) => +const check = (statusJson: string, versionDelay: Duration.Input = 0, versionStalls = false) => Effect.gen(function* () { const outputs: Record = { "--version": "fx 0.0.13\n", @@ -53,8 +58,13 @@ const check = (statusJson: string, versionDelay: Duration.Input = 0) => const args = ChildProcess.isStandardCommand(command) ? command.args.join(" ") : ""; invoked.push(args); const stdout = outputs[args]; - const handle = Effect.succeed(processHandle(stdout ?? "", stdout === undefined ? 2 : 0)); - return args === "--version" ? Effect.delay(handle, versionDelay) : handle; + if (args !== "--version") { + return Effect.succeed(processHandle(stdout ?? "", stdout === undefined ? 2 : 0)); + } + return Effect.delay( + Effect.succeed(processHandle(stdout ?? "", 0, versionStalls)), + versionDelay, + ); }); const draft = yield* checkFxProviderStatus(settings, {}).pipe( Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), @@ -67,6 +77,7 @@ describe("checkFxProviderStatus", () => { { label: "answers after 6 s", versionDelay: "6 seconds", + versionStalls: false, status: "ready", version: "0.0.13", message: undefined, @@ -75,6 +86,16 @@ describe("checkFxProviderStatus", () => { { label: "never answers", versionDelay: "Infinity", + versionStalls: false, + status: "error", + version: null, + message: "Failed to run `fx --version`.", + invoked: ["--version"], + }, + { + label: "starts but never answers", + versionDelay: 0, + versionStalls: true, status: "error", version: null, message: "Failed to run `fx --version`.", @@ -85,6 +106,7 @@ describe("checkFxProviderStatus", () => { const fiber = yield* check( JSON.stringify({ kind: "status", model: "anthropic/claude-opus-5.5", auth: "fx login" }), row.versionDelay, + row.versionStalls, ).pipe(Effect.forkChild); yield* TestClock.adjust("10 seconds"); const { draft, invoked } = yield* Fiber.join(fiber); diff --git a/packages/provider-pi/src/server/status.test.ts b/packages/provider-pi/src/server/status.test.ts index 1be07e55d8e7f..55caff62eac86 100644 --- a/packages/provider-pi/src/server/status.test.ts +++ b/packages/provider-pi/src/server/status.test.ts @@ -23,19 +23,22 @@ function processHandle(input: { readonly stdout?: string; readonly stderr?: string; readonly exitCode?: number; + /** Holds stdout and the exit back until it completes, like a CLI slow to answer. */ + readonly answered?: Effect.Effect; }) { + const answered = input.answered ?? Effect.void; const bytes = (value: string | undefined) => value === undefined || value.length === 0 ? Stream.empty : Stream.succeed(encoder.encode(value)); return ChildProcessSpawner.makeHandle({ pid: ChildProcessSpawner.ProcessId(900_000_001), - exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(input.exitCode ?? 0)), + exitCode: Effect.as(answered, ChildProcessSpawner.ExitCode(input.exitCode ?? 0)), isRunning: Effect.succeed(false), kill: () => Effect.void, unref: Effect.succeed(Effect.void), stdin: Sink.drain, - stdout: bytes(input.stdout), + stdout: Stream.unwrap(Effect.as(answered, bytes(input.stdout))), stderr: bytes(input.stderr), all: Stream.empty, getInputFd: () => Sink.drain, @@ -173,9 +176,11 @@ describe("PiProvider", () => { const spawner = ChildProcessSpawner.make((command) => { const args = ChildProcess.isStandardCommand(command) ? command.args : []; spawned.push(args.join(" ")); - return args.includes("--version") - ? Effect.delay(Effect.succeed(processHandle({ stdout: "pi 0.84.3\n" })), row.versionDelay) - : Effect.succeed(processHandle({ stderr: "RPC startup failed", exitCode: 1 })); + return Effect.succeed( + args.includes("--version") + ? processHandle({ stdout: "pi 0.84.3\n", answered: Effect.sleep(row.versionDelay) }) + : processHandle({ stderr: "RPC startup failed", exitCode: 1 }), + ); }); const fiber = yield* checkPiProviderStatus(settings).pipe( Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), From 7220e352bf0133e6b20456b8db140687c541dcd6 Mon Sep 17 00:00:00 2001 From: Victor Vogel Date: Sat, 31 Oct 2026 23:48:12 +0000 Subject: [PATCH 3/3] test(fx): hold back `fx --version` output and exit, not the spawn Like the Pi and Grok tests, the fx version probe now starts at once and delays its output and exit, so a timeout around the spawn alone fails the 6 second row. The never-answers row is now a running CLI that never exits. Co-Authored-By: Claude Opus 5.5 --- .../provider-fx/src/server/status.test.ts | 43 +++++++------------ 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/packages/provider-fx/src/server/status.test.ts b/packages/provider-fx/src/server/status.test.ts index 79ba8951d2a69..3f9ae01ae969a 100644 --- a/packages/provider-fx/src/server/status.test.ts +++ b/packages/provider-fx/src/server/status.test.ts @@ -16,20 +16,21 @@ import { checkFxProviderStatus } from "./status.ts"; const encoder = new TextEncoder(); const settings = Schema.decodeSync(FxSettings)({ enabled: true }); -/** A `stalled` process has started but never writes output or exits. */ -function processHandle(stdout: string, code: number, stalled = false) { +/** Holds stdout and the exit back until `answered` completes, like a CLI slow to answer. */ +function processHandle(stdout: string, code: number, answered: Effect.Effect = Effect.void) { return ChildProcessSpawner.makeHandle({ pid: ChildProcessSpawner.ProcessId(900_000_101), - exitCode: stalled ? Effect.never : Effect.succeed(ChildProcessSpawner.ExitCode(code)), + exitCode: Effect.as(answered, ChildProcessSpawner.ExitCode(code)), isRunning: Effect.succeed(false), kill: () => Effect.void, unref: Effect.succeed(Effect.void), stdin: Sink.drain, - stdout: stalled - ? Stream.never - : stdout.length === 0 - ? Stream.empty - : Stream.succeed(encoder.encode(stdout)), + stdout: Stream.unwrap( + Effect.as( + answered, + stdout.length === 0 ? Stream.empty : Stream.succeed(encoder.encode(stdout)), + ), + ), stderr: Stream.empty, all: Stream.empty, getInputFd: () => Sink.drain, @@ -38,7 +39,7 @@ function processHandle(stdout: string, code: number, stalled = false) { } /** Answers `fx` invocations by their arguments and records which ran. */ -const check = (statusJson: string, versionDelay: Duration.Input = 0, versionStalls = false) => +const check = (statusJson: string, versionDelay: Duration.Input = 0) => Effect.gen(function* () { const outputs: Record = { "--version": "fx 0.0.13\n", @@ -58,12 +59,12 @@ const check = (statusJson: string, versionDelay: Duration.Input = 0, versionStal const args = ChildProcess.isStandardCommand(command) ? command.args.join(" ") : ""; invoked.push(args); const stdout = outputs[args]; - if (args !== "--version") { - return Effect.succeed(processHandle(stdout ?? "", stdout === undefined ? 2 : 0)); - } - return Effect.delay( - Effect.succeed(processHandle(stdout ?? "", 0, versionStalls)), - versionDelay, + return Effect.succeed( + processHandle( + stdout ?? "", + stdout === undefined ? 2 : 0, + args === "--version" ? Effect.sleep(versionDelay) : Effect.void, + ), ); }); const draft = yield* checkFxProviderStatus(settings, {}).pipe( @@ -77,7 +78,6 @@ describe("checkFxProviderStatus", () => { { label: "answers after 6 s", versionDelay: "6 seconds", - versionStalls: false, status: "ready", version: "0.0.13", message: undefined, @@ -86,16 +86,6 @@ describe("checkFxProviderStatus", () => { { label: "never answers", versionDelay: "Infinity", - versionStalls: false, - status: "error", - version: null, - message: "Failed to run `fx --version`.", - invoked: ["--version"], - }, - { - label: "starts but never answers", - versionDelay: 0, - versionStalls: true, status: "error", version: null, message: "Failed to run `fx --version`.", @@ -106,7 +96,6 @@ describe("checkFxProviderStatus", () => { const fiber = yield* check( JSON.stringify({ kind: "status", model: "anthropic/claude-opus-5.5", auth: "fx login" }), row.versionDelay, - row.versionStalls, ).pipe(Effect.forkChild); yield* TestClock.adjust("10 seconds"); const { draft, invoked } = yield* Fiber.join(fiber);