The best way to control Claude Code, Codex and more from any computer or phone
fix(server): provider status checks no longer make mise download missing CLIs (#33448)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 10, 2026 at 00:03 UTC
5dcf69ebfa955669b8d34d0fa73d2d05d6b466d0
16 files changed
+252
-86
apps/server/src/provider/ClaudeProvider.ts
+5
-4
@@ -33,8 +33,9 @@ import {
33
COMPACT_SLASH_COMMAND,
34
DEFAULT_TIMEOUT_MS,
35
isCommandMissingCause,
36
- parseGenericCliVersion,
36
+ parseCliVersionResult,
37
providerModelsFromSettings,
38
+ providerProbeEnvironment,
39
spawnAndCollect,
40
type ServerProviderDraft,
41
} from "@t3tools/provider-core/server/snapshotProbe";
@@ -232,7 +233,7 @@ export function buildClaudeCapabilitiesProbeQueryOptions(input: {
233
mcpServers: {},
234
...(input.managedMcpConfig ? {} : { strictMcpConfig: true }),
235
env: {
235
- ...input.environment,
236
+ ...providerProbeEnvironment(input.environment),
237
// Disable claude.ai MCP separately; it is discovered outside filesystem config.
238
ENABLE_CLAUDEAI_MCP_SERVERS: "false",
239
// Skipping this avoids a Windows tasklist | findstr process tree on every refresh.
@@ -552,7 +553,7 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")(
553
const versionProbe = yield* runClaudeCommand(
554
claudeSettings,
555
["--version"],
555
- resolvedEnvironment,
556
+ providerProbeEnvironment(resolvedEnvironment),
557
cwd,
558
).pipe(Effect.timeoutOption(CLAUDE_VERSION_CHECK_TIMEOUT_MS), Effect.result);
559
@@ -596,7 +597,7 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")(
597
}
598
599
const version = versionProbe.success.value;
599
- const parsedVersion = parseGenericCliVersion(`${version.stdout}\n${version.stderr}`);
600
+ const parsedVersion = parseCliVersionResult(version);
601
if (version.code !== 0) {
602
yield* Effect.logWarning("Claude Agent CLI version probe exited with a non-zero status.", {
603
exitCode: version.code,
apps/server/src/provider/CodexProvider.ts
+6
-2
@@ -41,6 +41,7 @@ import {
41
COMPACT_SLASH_COMMAND,
42
DEFAULT_TIMEOUT_MS,
43
providerModelsFromSettings,
44
+ providerProbeEnvironment,
45
spawnAndCollect,
46
type ServerProviderDraft,
47
} from "@t3tools/provider-core/server/snapshotProbe";
@@ -650,7 +651,10 @@ export const probeCodexSkillsForCwd = Effect.fn("probeCodexSkillsForCwd")(functi
651
readonly cwd: string;
652
readonly environment?: NodeJS.ProcessEnv;
653
}) {
653
- const { client } = yield* withCodexAppServerClient(input);
654
+ const { client } = yield* withCodexAppServerClient({
655
+ ...input,
656
+ environment: providerProbeEnvironment(input.environment ?? process.env),
657
+ });
658
const skillsResponse = yield* client.request("skills/list", { cwds: [input.cwd] });
659
return parseCodexSkillsListResponse(skillsResponse, input.cwd);
660
});
@@ -753,7 +757,7 @@ export const checkCodexProviderStatus = Effect.fn("checkCodexProviderStatus")(fu
757
ServerSettingsError,
758
ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem | Path.Path
759
> {
756
- const resolvedEnvironment = environment ?? process.env;
760
+ const resolvedEnvironment = providerProbeEnvironment(environment ?? process.env);
761
const checkedAt = DateTime.formatIso(yield* DateTime.now);
762
const emptyModels = emptyCodexModelsFromSettings(codexSettings);
763
apps/server/src/provider/ProviderRegistry.test.ts
+43
@@ -3125,6 +3125,49 @@ it.layer(
3125
),
3126
);
3127
3128
+ it.effect("does not let a lazy mise shim install Claude during a status check (#33415)", () =>
3129
+ Effect.gen(function* () {
3130
+ if ((yield* HostProcess.Platform) === "win32") return;
3131
+ const fs = yield* FileSystem.FileSystem;
3132
+ const path = yield* Path.Path;
3133
+ const directory = yield* fs.makeTempDirectoryScoped({ prefix: "t3-fake-mise-claude-" });
3134
+ const installMarker = path.join(directory, "installed");
3135
+ const binaryPath = path.join(directory, "claude");
3136
+ // A `lazy = true` mise shim downloads and installs the tool unless MISE_OFFLINE is set.
3137
+ yield* fs.writeFileString(
3138
+ binaryPath,
3139
+ [
3140
+ `#!/bin/sh`,
3141
+ `case "$MISE_OFFLINE" in`,
3142
+ ` 1|true) cat >&2 <<'EOF'`,
3143
+ `mise WARN Failed to resolve tool version list for claude: [/home/u/.config/mise/config.toml] claude@latest: no versions found for claude`,
3144
+ `mise ERROR Failed to install aqua:anthropics/claude-code@latest: no versions found for claude`,
3145
+ `mise ERROR Version: 2026.11.5 linux-x64 (2026-11-09)`,
3146
+ `mise ERROR Run with --verbose or MISE_VERBOSE=1 for more information`,
3147
+ `EOF`,
3148
+ ` exit 1 ;;`,
3149
+ `esac`,
3150
+ `touch "${installMarker}"`,
3151
+ `echo "2.1.0 (Claude Code)"`,
3152
+ ].join("\n"),
3153
+ );
3154
+ yield* fs.chmod(binaryPath, 0o755);
3155
+ const { MISE_OFFLINE: _, ...environment } = process.env;
3156
+
3157
+ const status = yield* checkClaudeProviderStatus(
3158
+ { ...defaultClaudeSettings, binaryPath },
3159
+ claudeCapabilities(),
3160
+ environment,
3161
+ );
3162
+
3163
+ assert.isFalse(
3164
+ yield* fs.exists(installMarker),
3165
+ "the Claude --version status probe let mise install Claude",
3166
+ );
3167
+ assert.isNull(status.version, "mise's own version is not Claude's");
3168
+ }),
3169
+ );
3170
+
3171
it.effect("reports a logged-out CLI as unauthenticated", () =>
3172
Effect.gen(function* () {
3173
const status = yield* checkClaudeProviderStatus(
packages/provider-acp-registry/src/server/driver.test.ts
+1
-1
@@ -394,7 +394,7 @@ describe("acpRegistrySnapshotReadiness", () => {
394
),
395
);
396
397
- expect(receivedEnvironment).toBe(environment);
397
+ expect(receivedEnvironment).toEqual({ ...environment, MISE_OFFLINE: "1" });
398
expect(snapshot).toMatchObject({
399
auth: { status: "unknown" },
400
models: [{ slug: "agent-model" }],
packages/provider-acp-registry/src/server/driver.ts
+5
-2
@@ -33,7 +33,10 @@ import {
33
type ProviderDriver,
34
type ProviderInstance,
35
} from "@t3tools/provider-core/server/driver";
36
-import { providerModelsFromSettings } from "@t3tools/provider-core/server/snapshotProbe";
36
+import {
37
+ providerModelsFromSettings,
38
+ providerProbeEnvironment,
39
+} from "@t3tools/provider-core/server/snapshotProbe";
40
import { makeManualOnlyProviderMaintenanceCapabilities } from "@t3tools/provider-core/server/maintenanceResolver";
41
import {
42
haveProviderSnapshotSettingsChanged,
@@ -414,7 +417,7 @@ export const checkAcpRegistryProviderStatus = Effect.fn("AcpRegistryDriver.check
417
instanceId: input.instanceId,
418
settings: input.settings,
419
cwd: input.cwd,
417
- environment: input.environment,
420
+ environment: providerProbeEnvironment(input.environment),
421
}),
422
);
423
return Result.isFailure(probed)
packages/provider-core/src/server/snapshotProbe.ts
+17
@@ -103,6 +103,15 @@ export function isCommandMissingCause(error: unknown): boolean {
103
return error instanceof PlatformError.PlatformError && error.reason._tag === "NotFound";
104
}
105
106
+/**
107
+ * Environment for background status probes. A mise shim for a missing tool would otherwise
108
+ * download it on every refresh and leave a partial download behind when the probe times out.
109
+ * Sessions and user-started commands keep the plain environment, so mise still installs there.
110
+ */
111
+export function providerProbeEnvironment(environment: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
112
+ return { ...environment, MISE_OFFLINE: "1" };
113
+}
114
+
115
export const spawnAndCollect = Effect.fn("snapshotProbe.spawnAndCollect")(function* (
116
binaryPath: string,
117
command: ChildProcess.Command,
@@ -136,6 +145,14 @@ export function parseGenericCliVersion(output: string): string | null {
145
return match?.[1] ?? null;
146
}
147
148
+/** A failed `--version` run reports no version: its output can be a wrapper's, such as mise's. */
149
+export function parseCliVersionResult(
150
+ result: CommandResult,
151
+ parse: (output: string) => string | null = parseGenericCliVersion,
152
+): string | null {
153
+ return result.code === 0 ? parse(`${result.stdout}\n${result.stderr}`) : null;
154
+}
155
+
156
export function providerModelsFromSettings(
157
builtInModels: ReadonlyArray<ServerProviderModel>,
158
customModels: ReadonlyArray<CustomModelSetting>,
packages/provider-fx/src/server/status.ts
+6
-4
@@ -21,10 +21,11 @@ import {
21
buildServerProvider,
22
isCommandMissingCause,
23
nonEmptyTrimmed,
24
- parseGenericCliVersion,
24
+ parseCliVersionResult,
25
type ProviderProbeResult,
26
providerModelsFromSettings,
27
type ServerProviderDraft,
28
+ providerProbeEnvironment,
29
spawnAndCollect,
30
} from "@t3tools/provider-core/server/snapshotProbe";
31
@@ -163,7 +164,8 @@ export const checkFxProviderStatus = Effect.fn("checkFxProviderStatus")(function
164
});
165
}
166
166
- const versionResult = yield* runFxCli(settings, ["--version"], environment).pipe(
167
+ const probeEnvironment = providerProbeEnvironment(environment);
168
+ const versionResult = yield* runFxCli(settings, ["--version"], probeEnvironment).pipe(
169
Effect.timeoutOption(VERSION_PROBE_TIMEOUT_MS),
170
Effect.result,
171
);
@@ -178,7 +180,7 @@ export const checkFxProviderStatus = Effect.fn("checkFxProviderStatus")(function
180
});
181
}
182
const versionOutput = versionResult.success.value;
181
- const version = parseGenericCliVersion(`${versionOutput.stdout}\n${versionOutput.stderr}`);
183
+ const version = parseCliVersionResult(versionOutput);
184
if (versionOutput.code !== 0) {
185
return snapshot(settings, checkedAt, {
186
installed: true,
@@ -190,7 +192,7 @@ export const checkFxProviderStatus = Effect.fn("checkFxProviderStatus")(function
192
}
193
194
const read = (args: ReadonlyArray<string>) =>
193
- runFxCli(settings, args, environment).pipe(
195
+ runFxCli(settings, args, probeEnvironment).pipe(
196
Effect.timeoutOption(AUTH_PROBE_TIMEOUT_MS),
197
Effect.map(Option.filter((output) => output.code === 0)),
198
Effect.map(Option.map((output) => output.stdout)),
packages/provider-grok/src/server/probeEnvironment.ts
+3
-1
@@ -1,4 +1,6 @@
1
+import { providerProbeEnvironment } from "@t3tools/provider-core/server/snapshotProbe";
2
+
3
/** Suppress probe-time updater consoles on Windows; preserve update settings for other invocations. */
4
export function grokProbeEnvironment(environment: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
3
- return { ...environment, GROK_DISABLE_AUTOUPDATER: "1" };
5
+ return { ...providerProbeEnvironment(environment), GROK_DISABLE_AUTOUPDATER: "1" };
6
}
packages/provider-grok/src/server/skills.test.ts
+1
@@ -192,6 +192,7 @@ describe("discoverGrokSkills", () => {
192
expect(spawnOptions[0]?.env).toEqual({
193
GROK_DISABLE_AUTOUPDATER: "1",
194
GROK_HOME: "/home/dev/.grok",
195
+ MISE_OFFLINE: "1",
196
});
197
expect(environment.GROK_DISABLE_AUTOUPDATER).toBe("0");
198
});
packages/provider-grok/src/server/status.ts
+2
-2
@@ -28,7 +28,7 @@ import {
28
buildServerProvider,
29
COMPACT_SLASH_COMMAND,
30
isCommandMissingCause,
31
- parseGenericCliVersion,
31
+ parseCliVersionResult,
32
providerModelsFromSettings,
33
spawnAndCollect,
34
type ServerProviderDraft,
@@ -470,7 +470,7 @@ export const checkGrokProviderStatus = Effect.fn("checkGrokProviderStatus")(func
470
}
471
472
const versionOutput = versionResult.success.value;
473
- const version = parseGenericCliVersion(`${versionOutput.stdout}\n${versionOutput.stderr}`);
473
+ const version = parseCliVersionResult(versionOutput);
474
if (versionOutput.code !== 0) {
475
yield* Effect.logWarning("Grok CLI version probe exited with a non-zero status.", {
476
exitCode: versionOutput.code,
packages/provider-kiro/src/server/status.ts
+12
-6
@@ -27,11 +27,12 @@ import {
27
buildServerProvider,
28
COMPACT_SLASH_COMMAND,
29
isCommandMissingCause,
30
- parseGenericCliVersion,
30
+ parseCliVersionResult,
31
buildSelectOptionDescriptor,
32
type ProviderProbeResult,
33
providerModelsFromSettings,
34
type ServerProviderDraft,
35
+ providerProbeEnvironment,
36
spawnAndCollect,
37
} from "@t3tools/provider-core/server/snapshotProbe";
38
@@ -373,7 +374,8 @@ export const checkKiroProviderStatus = Effect.fn("checkKiroProviderStatus")(func
374
});
375
}
376
376
- const versionResult = yield* runKiroCli(settings, ["--version"], environment).pipe(
377
+ const probeEnvironment = providerProbeEnvironment(environment);
378
+ const versionResult = yield* runKiroCli(settings, ["--version"], probeEnvironment).pipe(
379
Effect.timeoutOption(VERSION_PROBE_TIMEOUT_MS),
380
Effect.result,
381
);
@@ -390,7 +392,7 @@ export const checkKiroProviderStatus = Effect.fn("checkKiroProviderStatus")(func
392
});
393
}
394
const versionOutput = versionResult.success.value;
393
- const version = parseGenericCliVersion(`${versionOutput.stdout}\n${versionOutput.stderr}`);
395
+ const version = parseCliVersionResult(versionOutput);
396
if (versionOutput.code !== 0) {
397
return snapshot(settings, checkedAt, {
398
installed: true,
@@ -404,7 +406,7 @@ export const checkKiroProviderStatus = Effect.fn("checkKiroProviderStatus")(func
406
const whoamiResult = yield* runKiroCli(
407
settings,
408
["whoami", "--format", "json"],
407
- environment,
409
+ probeEnvironment,
410
).pipe(Effect.timeoutOption(AUTH_PROBE_TIMEOUT_MS), Effect.result);
411
const auth = kiroAuthFromWhoami(
412
Result.isSuccess(whoamiResult) ? Option.getOrUndefined(whoamiResult.success) : undefined,
@@ -426,12 +428,16 @@ export const checkKiroProviderStatus = Effect.fn("checkKiroProviderStatus")(func
428
auth.status === "authenticated"
429
? yield* Effect.all(
430
[
429
- runKiroCli(settings, ["chat", "--list-models", "--format", "json"], environment).pipe(
431
+ runKiroCli(
432
+ settings,
433
+ ["chat", "--list-models", "--format", "json"],
434
+ probeEnvironment,
435
+ ).pipe(
436
Effect.timeoutOption(AUTH_PROBE_TIMEOUT_MS),
437
Effect.map((output) => kiroModelsFromList(Option.getOrUndefined(output))),
438
Effect.orElseSucceed(() => undefined),
439
),
434
- probeKiroAgents(settings, environment).pipe(
440
+ probeKiroAgents(settings, probeEnvironment).pipe(
441
Effect.timeoutOption(AUTH_PROBE_TIMEOUT_MS),
442
Effect.map(Option.getOrUndefined),
443
Effect.orElseSucceed(() => undefined),
packages/provider-muse/src/server/status.ts
+4
-2
@@ -15,7 +15,9 @@ import {
15
COMPACT_SLASH_COMMAND,
16
DEFAULT_TIMEOUT_MS,
17
isCommandMissingCause,
18
+ parseCliVersionResult,
19
providerModelsFromSettings,
20
+ providerProbeEnvironment,
21
spawnAndCollect,
22
type ProviderProbeResult,
23
} from "@t3tools/provider-core/server/snapshotProbe";
@@ -59,7 +61,7 @@ export const checkMuseProviderStatus = Effect.fn("checkMuseProviderStatus")(func
61
) {
62
if (!settings.enabled) return yield* makePendingMuseProvider(settings);
63
const checkedAt = DateTime.formatIso(yield* DateTime.now);
62
- const museEnvironment = environment ?? makeMuseEnvironment();
64
+ const museEnvironment = providerProbeEnvironment(environment ?? makeMuseEnvironment());
65
const snapshot = (probe: ProviderProbeResult, models: ReadonlyArray<ServerProviderModel> = []) =>
66
buildServerProvider({
67
presentation: MUSE_PRESENTATION,
@@ -105,7 +107,7 @@ export const checkMuseProviderStatus = Effect.fn("checkMuseProviderStatus")(func
107
});
108
}
109
const versionOutput = versionResult.success.value;
108
- const version = parseMuseVersion(`${versionOutput.stdout}\n${versionOutput.stderr}`);
110
+ const version = parseCliVersionResult(versionOutput, parseMuseVersion);
111
if (versionOutput.code !== 0) {
112
return snapshot({
113
installed: true,
packages/provider-opencode/src/server/driver.test.ts
+49
@@ -157,6 +157,20 @@ it.live("discovers models through a home-relative OpenCode wrapper", () =>
157
),
158
);
159
160
+// Under MISE_OFFLINE the shim cannot install OpenCode; a normal run installs 2.x first.
161
+const lazyMiseShim = {
162
+ ...openCode2Runtime,
163
+ runOpenCodeCommand: ({ environment }: { readonly environment?: NodeJS.ProcessEnv }) =>
164
+ environment?.MISE_OFFLINE === "1"
165
+ ? Effect.fail(
166
+ new OpenCodeRuntime.OpenCodeRuntimeError({
167
+ operation: "runOpenCodeCommand",
168
+ detail: "mise ERROR Failed to install opencode@latest",
169
+ }),
170
+ )
171
+ : Effect.succeed({ stdout: "opencode v2.0.18\n", stderr: "", code: 0 }),
172
+} as unknown as OpenCodeRuntime.OpenCodeRuntime["Service"];
173
+
174
it.layer(layer)("OpenCodeDriver runtime selection", (it) => {
175
it.effect("never starts a 1.x server for an OpenCode 2 instance", () =>
176
Effect.gen(function* () {
@@ -173,6 +187,41 @@ it.layer(layer)("OpenCodeDriver runtime selection", (it) => {
187
}).pipe(Effect.scoped),
188
);
189
190
+ it.effect("opens a session through OpenCode 2 that a lazy mise shim installs on first use", () =>
191
+ Effect.gen(function* () {
192
+ serverStarts.length = 0;
193
+ const instance = yield* create({}, noHttp).pipe(
194
+ Effect.provideService(OpenCodeRuntime.OpenCodeRuntime, lazyMiseShim),
195
+ // The background status check probes offline, which this shim always fails.
196
+ Effect.provide(TestProviderHost.layer({ runBackgroundWork: false })),
197
+ );
198
+
199
+ yield* instance.orchestrationAdapter
200
+ .openSession({
201
+ threadId: ThreadId.make("thread-lazy-mise"),
202
+ providerSessionId: ProviderSessionId.make("session-lazy-mise"),
203
+ modelSelection: { instanceId: instance.instanceId, model: "opencode/big-pickle" },
204
+ runtimePolicy: { runtimeMode: "full-access", interactionMode: "default", cwd: null },
205
+ })
206
+ .pipe(Effect.scoped, Effect.flip);
207
+ assert.deepStrictEqual(serverStarts, ["start"], "the OpenCode 2 adapter starts its server");
208
+ const capabilities = yield* instance.orchestrationAdapter.getCapabilities();
209
+ assert.isTrue(capabilities.sessions.supportsRuntimeModeSwitchInSession);
210
+ }).pipe(Effect.scoped),
211
+ );
212
+
213
+ it.effect("does not scan a workspace through a 1.x server it could not probe offline", () =>
214
+ Effect.gen(function* () {
215
+ serverStarts.length = 0;
216
+ const instance = yield* create({}, noHttp).pipe(
217
+ Effect.provideService(OpenCodeRuntime.OpenCodeRuntime, lazyMiseShim),
218
+ );
219
+
220
+ yield* Effect.flip(instance.snapshotForCwd!(process.cwd()));
221
+ assert.deepStrictEqual(serverStarts, []);
222
+ }).pipe(Effect.scoped),
223
+ );
224
+
225
it.effect("answers capability reads without waiting on an unreachable server", () =>
226
Effect.gen(function* () {
227
const hang = HttpClient.make(() => Effect.never);
packages/provider-opencode/src/server/driver.ts
+89
-56
@@ -53,6 +53,7 @@ import {
53
} from "@t3tools/provider-core/server/driver";
54
import { withInstanceIdentity } from "@t3tools/provider-core/server/instanceIdentity";
55
import { mergeProviderInstanceEnvironment } from "@t3tools/provider-core/server/instanceEnvironment";
56
+import { providerProbeEnvironment } from "@t3tools/provider-core/server/snapshotProbe";
57
import {
58
enrichProviderSnapshotWithVersionAdvisory,
59
makeCachedProviderMaintenanceResolution,
@@ -109,6 +110,7 @@ function byOpenCodeRuntime<A, E, R, PE>(
110
// Hot reads use the last successful probe; session opens await it to select the correct protocol.
111
function selectOpenCodeRuntimeAdapter(input: {
112
readonly probe: OpenCodeRuntimeProbe;
113
+ readonly resolve: Effect.Effect<ProbedOpenCode, OpenCodeRuntime.OpenCodeRuntimeError>;
114
readonly v1: ProviderAdapter.ProviderAdapterV2["Service"];
115
readonly v2: ProviderAdapter.ProviderAdapterV2["Service"];
116
}): ProviderAdapter.ProviderAdapterV2["Service"] {
@@ -122,43 +124,43 @@ function selectOpenCodeRuntimeAdapter(input: {
124
planSelectionTransition: (transition) =>
125
Effect.flatMap(hot, (adapter) => adapter.planSelectionTransition(transition)),
126
openSession: (session) =>
125
- Effect.flatMap(pick(input.probe.get), (adapter) => adapter.openSession(session)),
127
+ Effect.flatMap(pick(input.resolve), (adapter) => adapter.openSession(session)),
128
};
129
}
130
131
function selectOpenCodeRuntimeTextGeneration(
130
- probe: OpenCodeRuntimeProbe,
132
+ resolve: Effect.Effect<ProbedOpenCode, OpenCodeRuntime.OpenCodeRuntimeError>,
133
v1: ProviderTextGeneration,
134
v2: ProviderTextGeneration,
135
): ProviderTextGeneration {
136
return {
137
generateCommitMessage: (input) =>
136
- byOpenCodeRuntime(probe.get, {
138
+ byOpenCodeRuntime(resolve, {
139
v1: v1.generateCommitMessage(input),
140
v2: v2.generateCommitMessage(input),
141
}),
142
generatePrContent: (input) =>
141
- byOpenCodeRuntime(probe.get, {
143
+ byOpenCodeRuntime(resolve, {
144
v1: v1.generatePrContent(input),
145
v2: v2.generatePrContent(input),
146
}),
147
generateBranchName: (input) =>
146
- byOpenCodeRuntime(probe.get, {
148
+ byOpenCodeRuntime(resolve, {
149
v1: v1.generateBranchName(input),
150
v2: v2.generateBranchName(input),
151
}),
152
generateThreadTitle: (input) =>
151
- byOpenCodeRuntime(probe.get, {
153
+ byOpenCodeRuntime(resolve, {
154
v1: v1.generateThreadTitle(input),
155
v2: v2.generateThreadTitle(input),
156
}),
157
generateReviewGuide: (input) =>
156
- byOpenCodeRuntime(probe.get, {
158
+ byOpenCodeRuntime(resolve, {
159
v1: v1.generateReviewGuide(input),
160
v2: v2.generateReviewGuide(input),
161
}),
162
generateTranscriptionPostProcessing: (input) =>
161
- byOpenCodeRuntime(probe.get, {
163
+ byOpenCodeRuntime(resolve, {
164
v1: v1.generateTranscriptionPostProcessing(input),
165
v2: v2.generateTranscriptionPostProcessing(input),
166
}),
@@ -225,12 +227,27 @@ export const OpenCodeDriver: ProviderDriver<
227
// The instance registry has already read a referenced password from its secret provider.
228
serverPassword: settingsSecretLiteral(config.serverPassword),
229
} satisfies OpenCodeSettings;
228
- const runtimeProbe = yield* makeOpenCodeRuntimeProbe(
229
- probeOpenCodeRuntime(effectiveConfig, processEnv).pipe(
230
+ const probeRuntime = (probeEnv: NodeJS.ProcessEnv) =>
231
+ probeOpenCodeRuntime(effectiveConfig, probeEnv).pipe(
232
Effect.provideService(HttpClient.HttpClient, httpClient),
233
Effect.provideService(OpenCodeRuntime.OpenCodeRuntime, openCodeRuntime),
232
- ),
234
+ );
235
+ const runtimeProbe = yield* makeOpenCodeRuntimeProbe(
236
+ probeRuntime(providerProbeEnvironment(processEnv)),
237
);
238
+ // A mise shim cannot install OpenCode offline; a session or text generation the user started
239
+ // may, so without a cached result it probes once online and caches what mise installed.
240
+ const resolveRuntime =
241
+ effectiveConfig.serverUrl.trim().length > 0
242
+ ? runtimeProbe.get
243
+ : runtimeProbe.lastSuccess.pipe(
244
+ Effect.flatMap(
245
+ Option.match({
246
+ onSome: Effect.succeed,
247
+ onNone: () => probeRuntime(processEnv).pipe(Effect.tap(runtimeProbe.record)),
248
+ }),
249
+ ),
250
+ );
251
const noUpdate = makeManualOnlyProviderMaintenanceCapabilities({
252
provider: DRIVER_KIND,
253
packageName: null,
@@ -296,6 +313,7 @@ export const OpenCodeDriver: ProviderDriver<
313
);
314
const orchestrationAdapter = selectOpenCodeRuntimeAdapter({
315
probe: runtimeProbe,
316
+ resolve: resolveRuntime,
317
v1: openCodeV1Adapter,
318
v2: yield* OpenCode2AdapterV2.make(instanceId).pipe(
319
Effect.provideService(OpenCode2Server.OpenCode2Server, openCode2Server),
@@ -344,7 +362,7 @@ export const OpenCodeDriver: ProviderDriver<
362
environment: processEnv,
363
});
364
const textGeneration = selectOpenCodeRuntimeTextGeneration(
347
- runtimeProbe,
365
+ resolveRuntime,
366
yield* makeOpenCodeTextGeneration(effectiveConfig).pipe(
367
Effect.provideService(OpenCodeServerOwner.OpenCodeServerOwner, serverOwner),
368
),
@@ -497,55 +515,70 @@ export const OpenCodeDriver: ProviderDriver<
515
accentColor,
516
enabled,
517
snapshot,
518
+ // A scan never installs OpenCode: without an offline probe result it fails and keeps the
519
+ // last inventory rather than guessing 1.x.
520
snapshotForCwd: (cwd) =>
521
!effectiveConfig.enabled
522
? snapshot.getSnapshot
503
- : byOpenCodeRuntime(runtimeProbe.get, {
504
- v2: Effect.all([
505
- snapshot.getSnapshot,
506
- listOpenCode2Workspace(cwd).pipe(
507
- Effect.timeout("20 seconds"),
508
- Effect.mapError(
509
- (cause) =>
510
- new ProviderDriverError({
511
- driver: DRIVER_KIND,
512
- instanceId,
513
- detail: `Failed to list OpenCode commands and skills for '${cwd}'`,
514
- cause,
515
- }),
516
- ),
517
- ),
518
- ]).pipe(
519
- Effect.map(([machineSnapshot, { skills, commands }]) => ({
520
- ...machineSnapshot,
521
- skills: openCode2SkillsToServerProviderSkills(skills),
522
- slashCommands: openCode2CommandsToServerProviderSlashCommands(commands),
523
- // A finished scan lists at least the built-ins. None means it
524
- // timed out, so the registry decides from the provider's health.
525
- slashCommandsPending: commands.length > 0 ? false : undefined,
526
- })),
523
+ : runtimeProbe.get.pipe(
524
+ Effect.mapError(
525
+ (cause) =>
526
+ new ProviderDriverError({
527
+ driver: DRIVER_KIND,
528
+ instanceId,
529
+ detail: `Failed to probe OpenCode for '${cwd}'`,
530
+ cause,
531
+ }),
532
),
528
- v1: Effect.all([
529
- snapshot.getSnapshot,
530
- loadWorkspaceForCwd(cwd).pipe(Effect.timeout("20 seconds")),
531
- ]).pipe(
532
- Effect.map(([machineSnapshot, { skills, commands, slashCommandsPending }]) => ({
533
- ...machineSnapshot,
534
- skills: openCodeSkillsToServerProviderSkills(skills),
535
- slashCommands: openCodeCommandsToServerProviderSlashCommands(commands),
536
- slashCommandsPending,
537
- })),
538
- Effect.mapError(
539
- (cause) =>
540
- new ProviderDriverError({
541
- driver: DRIVER_KIND,
542
- instanceId,
543
- detail: `Failed to probe OpenCode commands and skills for '${cwd}'`,
544
- cause,
545
- }),
546
- ),
533
+ Effect.flatMap((probed) =>
534
+ byOpenCodeRuntime(Effect.succeed(probed), {
535
+ v2: Effect.all([
536
+ snapshot.getSnapshot,
537
+ listOpenCode2Workspace(cwd).pipe(
538
+ Effect.timeout("20 seconds"),
539
+ Effect.mapError(
540
+ (cause) =>
541
+ new ProviderDriverError({
542
+ driver: DRIVER_KIND,
543
+ instanceId,
544
+ detail: `Failed to list OpenCode commands and skills for '${cwd}'`,
545
+ cause,
546
+ }),
547
+ ),
548
+ ),
549
+ ]).pipe(
550
+ Effect.map(([machineSnapshot, { skills, commands }]) => ({
551
+ ...machineSnapshot,
552
+ skills: openCode2SkillsToServerProviderSkills(skills),
553
+ slashCommands: openCode2CommandsToServerProviderSlashCommands(commands),
554
+ // A finished scan lists at least the built-ins. None means it
555
+ // timed out, so the registry decides from the provider's health.
556
+ slashCommandsPending: commands.length > 0 ? false : undefined,
557
+ })),
558
+ ),
559
+ v1: Effect.all([
560
+ snapshot.getSnapshot,
561
+ loadWorkspaceForCwd(cwd).pipe(Effect.timeout("20 seconds")),
562
+ ]).pipe(
563
+ Effect.map(([machineSnapshot, { skills, commands, slashCommandsPending }]) => ({
564
+ ...machineSnapshot,
565
+ skills: openCodeSkillsToServerProviderSkills(skills),
566
+ slashCommands: openCodeCommandsToServerProviderSlashCommands(commands),
567
+ slashCommandsPending,
568
+ })),
569
+ Effect.mapError(
570
+ (cause) =>
571
+ new ProviderDriverError({
572
+ driver: DRIVER_KIND,
573
+ instanceId,
574
+ detail: `Failed to probe OpenCode commands and skills for '${cwd}'`,
575
+ cause,
576
+ }),
577
+ ),
578
+ ),
579
+ }),
580
),
548
- }),
581
+ ),
582
orchestrationAdapter,
583
textGeneration,
584
} satisfies ProviderInstance;
packages/provider-opencode/src/server/versionProbe.ts
+1
@@ -185,5 +185,6 @@ export const makeOpenCodeRuntimeProbe = <E>(probe: Effect.Effect<ProbedOpenCode,
185
get: Cache.get(cache, undefined),
186
refresh: Cache.refresh(cache, undefined),
187
lastSuccess: Cache.getSuccess(cache, undefined),
188
+ record: (probed: ProbedOpenCode) => Cache.set(cache, undefined, probed),
189
}),
190
);
packages/provider-pi/src/server/status.ts
+8
-6
@@ -31,8 +31,9 @@ import {
31
buildServerProvider,
32
DEFAULT_TIMEOUT_MS,
33
isCommandMissingCause,
34
- parseGenericCliVersion,
34
+ parseCliVersionResult,
35
providerModelsFromSettings,
36
+ providerProbeEnvironment,
37
spawnAndCollect,
38
type ServerProviderDraft,
39
} from "@t3tools/provider-core/server/snapshotProbe";
@@ -204,7 +205,7 @@ export const discoverPiCommandsForCwd = Effect.fn("discoverPiCommandsForCwd")(
205
}
206
const connection = yield* makePiDiscoveryConnection(
207
piSettings,
207
- environment,
208
+ providerProbeEnvironment(environment),
209
launchArgs.args,
210
cwd,
211
);
@@ -349,7 +350,8 @@ export const checkPiProviderStatus = Effect.fn("checkPiProviderStatus")(function
350
});
351
}
352
352
- const versionResult = yield* runPiVersionCommand(piSettings, environment).pipe(
353
+ const probeEnvironment = providerProbeEnvironment(environment);
354
+ const versionResult = yield* runPiVersionCommand(piSettings, probeEnvironment).pipe(
355
Effect.timeoutOption(VERSION_PROBE_TIMEOUT_MS),
356
Effect.result,
357
);
@@ -391,7 +393,7 @@ export const checkPiProviderStatus = Effect.fn("checkPiProviderStatus")(function
393
}
394
395
const versionOutput = versionResult.success.value;
394
- const version = parseGenericCliVersion(`${versionOutput.stdout}\n${versionOutput.stderr}`);
396
+ const version = parseCliVersionResult(versionOutput);
397
if (versionOutput.code !== 0) {
398
return buildServerProvider({
399
presentation: PI_PRESENTATION,
@@ -459,7 +461,7 @@ export const checkPiProviderStatus = Effect.fn("checkPiProviderStatus")(function
461
462
const discoveryExit = yield* discoverPiViaRpc(
463
piSettings,
462
- environment,
464
+ probeEnvironment,
465
resolvedLaunchArgs.args,
466
cwd,
467
).pipe(Effect.timeoutOption(PI_RPC_DISCOVERY_TIMEOUT_MS), Effect.exit);
@@ -507,7 +509,7 @@ export const checkPiProviderStatus = Effect.fn("checkPiProviderStatus")(function
509
? undefined
510
: yield* describeUnavailablePiModel(
511
piSettings,
510
- environment,
512
+ probeEnvironment,
513
version,
514
resolvedLaunchArgs.args,
515
discovery.unavailableActiveModel,