@devries-cameron20 / t3code Mirror · read-only / commits / 15695ee78f
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 23:30 UTC

fix(opencode): omit unsupported reasoning options from catalog models (#19000)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Abdul committed Nov 11, 2026 at 19:34 UTC 15695ee78f5515bdd36beb928a3c51554fcff3a5
7 files changed +419 -10
packages/provider-opencode/src/server/OpenCodeRuntime.ts
+38
@@ -230,6 +230,44 @@ export interface ParsedOpenCodeModelSlug {
230 readonly modelID: string;
231 }
232
233 +export type OpenCodeVariantCache = Map<string, ReadonlySet<string> | undefined>;
234 +
235 +export const resolveOpenCodeVariant = Effect.fnUntraced(function* (
236 + client: OpencodeClient,
237 + model: ParsedOpenCodeModelSlug | undefined,
238 + variant: string | undefined,
239 + abortSignal?: AbortSignal,
240 + cache?: OpenCodeVariantCache,
241 +) {
242 + if (!variant || !model) return variant;
243 +
244 + const key = `${model.providerID}/${model.modelID}`;
245 + const cached = cache?.get(key);
246 + if (cache?.has(key)) {
247 + return cached !== undefined && !cached.has(variant) ? undefined : variant;
248 + }
249 +
250 + // Only a confirmed catalog mismatch can invalidate a persisted selection.
251 + const response = yield* runOpenCodeSdk("provider.list", (signal) =>
252 + client.provider.list(undefined, {
253 + signal: abortSignal ? AbortSignal.any([signal, abortSignal]) : signal,
254 + }),
255 + ).pipe(
256 + Effect.timeout("10 seconds"),
257 + Effect.orElseSucceed(() => undefined),
258 + );
259 + if (response?.data === undefined) return variant;
260 +
261 + const catalogModel = response.data.all.find((provider) => provider.id === model.providerID)
262 + ?.models[model.modelID];
263 + const variants = catalogModel ? new Set(Object.keys(catalogModel.variants ?? {})) : undefined;
264 + if (cache !== undefined) {
265 + // Keep only this model's names; provider.list can return several megabytes.
266 + cache.set(key, variants);
267 + }
268 + return variants !== undefined && !variants.has(variant) ? undefined : variant;
269 +});
270 +
271 export interface OpenCodeSkill {
272 readonly name?: string | null;
273 readonly description?: string | null;
packages/provider-opencode/src/server/adapter.test.ts
+263 -1
@@ -35,6 +35,7 @@ import * as Layer from "effect/Layer";
35 import * as Option from "effect/Option";
36 import * as Schema from "effect/Schema";
37 import * as Stream from "effect/Stream";
38 +import * as TestClock from "effect/testing/TestClock";
39
40 import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
41 import * as TestProviderHost from "@t3tools/provider-testing/TestProviderHost";
@@ -154,6 +155,7 @@ const makeOpenCodeRuntimeHarness = Effect.fn("makeOpenCodeRuntimeHarness")(funct
155 client: object,
156 host: Partial<ProviderHost.ProviderHost["Service"]> = {},
157 turnSettings: {
158 + readonly model?: string;
159 readonly options?: ReadonlyArray<ProviderOptionSelection>;
160 readonly interactionMode?: ProviderAdapter.ProviderAdapterV2RuntimePolicy["interactionMode"];
161 } = {},
@@ -162,7 +164,7 @@ const makeOpenCodeRuntimeHarness = Effect.fn("makeOpenCodeRuntimeHarness")(funct
164 const threadId = ThreadId.make(`thread-opencode-${suffix}`);
165 const modelSelection = {
166 instanceId,
165 - model: "anthropic/claude-sonnet",
167 + model: turnSettings.model ?? "anthropic/claude-sonnet",
168 options: turnSettings.options ?? [],
169 };
170 const policy = runtimePolicy("full-access", {
@@ -255,6 +257,266 @@ const makeOpenCodeRuntimeHarness = Effect.fn("makeOpenCodeRuntimeHarness")(funct
257 });
258
259 describe("OpenCodeAdapterV2", () => {
260 + it.effect.each([
261 + ["empty", "prompt"],
262 + ["unsupported", "command"],
263 + ["supported", "command"],
264 + ["unknown", "prompt"],
265 + ["failure", "prompt"],
266 + ["unset", "prompt"],
267 + ] as const)("normalizes reasoning variants for %s inventory at %s dispatch", ([kind, request]) =>
268 + Effect.gen(function* () {
269 + const suffix = `variant-${kind}-${request}`;
270 + const nativeEvents = asyncEventStream();
271 + const inputs: Array<Record<string, unknown>> = [];
272 + let inventoryCalls = 0;
273 + const receive = async (input: Record<string, unknown>) => {
274 + inputs.push(input);
275 + return { data: true };
276 + };
277 + const harness = yield* makeOpenCodeRuntimeHarness(
278 + suffix,
279 + suffix,
280 + {
281 + event: {
282 + subscribe: async (_input: unknown, options: { signal?: AbortSignal }) => {
283 + options.signal?.addEventListener("abort", () => nativeEvents.close(), { once: true });
284 + return { stream: nativeEvents.stream };
285 + },
286 + },
287 + provider: {
288 + list: async () => {
289 + inventoryCalls++;
290 + if (kind === "failure") throw new Error("inventory unavailable");
291 + return {
292 + data: {
293 + all: [
294 + {
295 + id: "opencode",
296 + models:
297 + kind === "unknown"
298 + ? {}
299 + : {
300 + "big-pickle": {
301 + id: "big-pickle",
302 + variants:
303 + kind === "supported"
304 + ? { medium: {} }
305 + : kind === "unsupported"
306 + ? { high: {} }
307 + : {},
308 + },
309 + },
310 + },
311 + ],
312 + },
313 + };
314 + },
315 + },
316 + command: { list: async () => ({ data: [{ name: "review" }] }) },
317 + session: {
318 + create: async () => ({ data: { id: suffix, time: { created: 1, updated: 1 } } }),
319 + promptAsync: receive,
320 + command: receive,
321 + },
322 + },
323 + {},
324 + {
325 + model: "opencode/big-pickle",
326 + options: [
327 + ...(kind === "unset" ? [] : [{ id: "variant", value: "medium" }]),
328 + { id: "agent", value: "plan" },
329 + ],
330 + },
331 + );
332 + yield* harness.startTurn(request === "command" ? "/review staged changes" : "hello");
333 + assert.equal(inputs.length, 1);
334 + const payload = inputs[0]!;
335 + assert.equal(payload.agent, "plan");
336 + if (kind === "supported" || kind === "unknown" || kind === "failure") {
337 + assert.equal(payload.variant, "medium");
338 + } else {
339 + assert.equal(Object.hasOwn(payload, "variant"), false);
340 + }
341 + if (kind === "unset") assert.equal(inventoryCalls, 0);
342 + }).pipe(
343 + Effect.provide(Layer.merge(IdAllocator.layer, McpProviderSessions.layer)),
344 + Effect.scoped,
345 + ),
346 + );
347 +
348 + it.effect("reuses successful model variants for the session and retries failed inventories", () =>
349 + Effect.gen(function* () {
350 + const sessionId = "variant-cache";
351 + const nativeEvents = asyncEventStream();
352 + const inputs: Array<Record<string, unknown>> = [];
353 + let inventoryCalls = 0;
354 + let variants: Record<string, object> = {};
355 + const harness = yield* makeOpenCodeRuntimeHarness(
356 + sessionId,
357 + sessionId,
358 + {
359 + event: {
360 + subscribe: async (_input: unknown, options: { signal?: AbortSignal }) => {
361 + options.signal?.addEventListener("abort", () => nativeEvents.close(), { once: true });
362 + return { stream: nativeEvents.stream };
363 + },
364 + },
365 + provider: {
366 + list: async () => {
367 + inventoryCalls++;
368 + if (inventoryCalls === 1) throw new Error("inventory unavailable");
369 + return {
370 + data: {
371 + all: [{ id: "opencode", models: { "big-pickle": { variants } } }],
372 + },
373 + };
374 + },
375 + },
376 + session: {
377 + create: async () => ({ data: { id: sessionId, time: { created: 1, updated: 1 } } }),
378 + promptAsync: async (input: Record<string, unknown>) => {
379 + inputs.push(input);
380 + return { data: true };
381 + },
382 + },
383 + },
384 + {},
385 + { model: "opencode/big-pickle", options: [{ id: "variant", value: "medium" }] },
386 + );
387 + const submit = Effect.fnUntraced(function* () {
388 + yield* harness.startTurn();
389 + yield* Effect.promise(() =>
390 + nativeEvents.push({
391 + type: "message.updated",
392 + properties: {
393 + sessionID: sessionId,
394 + info: {
395 + id: inputs.at(-1)!.messageID,
396 + sessionID: sessionId,
397 + role: "user",
398 + time: { created: 1 },
399 + },
400 + },
401 + }),
402 + );
403 + yield* Effect.promise(() =>
404 + nativeEvents.push({ type: "session.idle", properties: { sessionID: sessionId } }),
405 + );
406 + yield* harness.runtime.events.pipe(
407 + Stream.filter((event) => event.type === "turn.terminal"),
408 + Stream.take(1),
409 + Stream.runDrain,
410 + );
411 + return inputs.at(-1)!;
412 + });
413 +
414 + assert.equal((yield* submit()).variant, "medium");
415 + assert.equal(inventoryCalls, 1);
416 + assert.isFalse(Object.hasOwn(yield* submit(), "variant"));
417 + assert.equal(inventoryCalls, 2);
418 + variants = { medium: {} };
419 + assert.isFalse(Object.hasOwn(yield* submit(), "variant"));
420 + assert.equal(inventoryCalls, 2);
421 + }).pipe(
422 + Effect.provide(Layer.merge(IdAllocator.layer, McpProviderSessions.layer)),
423 + Effect.scoped,
424 + ),
425 + );
426 +
427 + it.effect("keeps queued steers behind a cold catalog lookup and cancels them on stop", () =>
428 + Effect.gen(function* () {
429 + const sessionId = "catalog-admission";
430 + const nativeEvents = asyncEventStream();
431 + const catalogStarted = promiseGate<void>();
432 + const calls: string[] = [];
433 + const harness = yield* makeOpenCodeRuntimeHarness(
434 + sessionId,
435 + sessionId,
436 + {
437 + event: {
438 + subscribe: async (_input: unknown, options: { signal?: AbortSignal }) => {
439 + options.signal?.addEventListener("abort", () => nativeEvents.close(), { once: true });
440 + return { stream: nativeEvents.stream };
441 + },
442 + },
443 + provider: {
444 + list: async (_input: unknown, { signal }: { signal: AbortSignal }) => {
445 + calls.push("catalog");
446 + catalogStarted.resolve();
447 + await new Promise<void>((_resolve, reject) => {
448 + signal.addEventListener(
449 + "abort",
450 + () => {
451 + calls.push("catalog-aborted");
452 + reject(signal.reason);
453 + },
454 + { once: true },
455 + );
456 + });
457 + return { data: { all: [] } };
458 + },
459 + },
460 + session: {
461 + create: async () => ({ data: { id: sessionId, time: { created: 1, updated: 1 } } }),
462 + get: async () => ({ data: { id: sessionId, time: { created: 1, updated: 1 } } }),
463 + messages: async () => ({ data: [] }),
464 + children: async () => ({ data: [] }),
465 + promptAsync: async (_input: unknown, { signal }: { signal: AbortSignal }) => {
466 + signal.throwIfAborted();
467 + calls.push("prompt");
468 + return { data: true };
469 + },
470 + abort: async () => {
471 + calls.push("abort");
472 + return { data: true };
473 + },
474 + },
475 + },
476 + {},
477 + { model: "opencode/big-pickle", options: [{ id: "variant", value: "medium" }] },
478 + );
479 + const start = yield* harness.startTurn().pipe(Effect.forkScoped);
480 + yield* Effect.promise(() => catalogStarted.promise);
481 + const snapshot = yield* harness.runtime.readThreadSnapshot({
482 + providerThread: harness.providerThread,
483 + });
484 + const activeTurn = snapshot.providerTurns.at(-1)!;
485 + const steer = (message: string) =>
486 + harness.runtime
487 + .steerTurn({
488 + threadId: harness.threadId,
489 + runId: harness.runId,
490 + providerThread: harness.providerThread,
491 + providerTurnId: activeTurn.id,
492 + message: {
493 + messageId: MessageId.make(message),
494 + text: message,
495 + attachments: [],
496 + createdBy: "user",
497 + creationSource: "web",
498 + },
499 + })
500 + .pipe(Effect.exit, Effect.forkScoped({ startImmediately: true }));
501 + const firstSteer = yield* steer("first follow-up");
502 + const secondSteer = yield* steer("second follow-up");
503 + yield* TestClock.adjust("5 seconds");
504 + assert.deepEqual(calls, ["catalog"]);
505 +
506 + yield* harness.runtime.interruptTurn({
507 + providerThread: harness.providerThread,
508 + providerTurnId: activeTurn.id,
509 + });
510 + yield* Fiber.join(start);
511 + assert.isTrue(Exit.isFailure(yield* Fiber.join(firstSteer)));
512 + assert.isTrue(Exit.isFailure(yield* Fiber.join(secondSteer)));
513 + assert.deepEqual(calls, ["catalog", "catalog-aborted", "abort"]);
514 + }).pipe(
515 + Effect.provide(Layer.merge(IdAllocator.layer, McpProviderSessions.layer)),
516 + Effect.scoped,
517 + ),
518 + );
519 +
520 it.effect.each([
521 {
522 message: "<none>",
packages/provider-opencode/src/server/adapter.ts
+28 -3
@@ -1003,6 +1003,7 @@ export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function
1003 const events = yield* Queue.unbounded<ProviderAdapter.ProviderAdapterV2Event, Cause.Done>();
1004 let nativeStreamFailure: OrchestrationV2ProviderFailure | null = null;
1005 const threads = new Map<string, OpenCodeThreadState>();
1006 + const variantCache: OpenCodeRuntime.OpenCodeVariantCache = new Map();
1007 const commandReceipts = new Map<string, Deferred.Deferred<void>>();
1008 const commandControllers = new Map<string, Set<AbortController>>();
1009 const pendingRequests = new Map<string, PendingOpenCodeRequest>();
@@ -2999,12 +3000,24 @@ export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function
3000 const submitPrompt = Effect.fn("OpenCode.submitPrompt")(function* (
3001 state: OpenCodeThreadState,
3002 turn: ActiveOpenCodeTurn,
3002 - payload: Parameters<typeof client.session.promptAsync>[0] & {
3003 + inputPayload: Parameters<typeof client.session.promptAsync>[0] & {
3004 messageID: string;
3005 sessionID: string;
3006 },
3007 abortController: AbortController,
3008 ) {
3009 + const { variant, ...payloadWithoutVariant } = inputPayload;
3010 + const selectedVariant = yield* OpenCodeRuntime.resolveOpenCodeVariant(
3011 + client,
3012 + inputPayload.model,
3013 + variant,
3014 + abortController.signal,
3015 + variantCache,
3016 + );
3017 + const payload = {
3018 + ...payloadWithoutVariant,
3019 + ...(selectedVariant === undefined ? {} : { variant: selectedVariant }),
3020 + };
3021 const text = payload.parts
3022 ?.filter((part) => part.type === "text")
3023 .map((part) => part.text)
@@ -3421,8 +3434,20 @@ export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function
3434 ...(text.length === 0 ? [] : [{ type: "text" as const, text }]),
3435 ...files,
3436 ];
3437 + const admissionMessageId = yield* makeOpenCodeMessageId(messageIdClock);
3438 + while (turn.admissionAbortController !== null) {
3439 + const pendingAdmission = turn.admissionSettled;
3440 + yield* Deferred.await(pendingAdmission);
3441 + // Another waiting steer may have claimed admission first.
3442 + if (turn.admissionSettled === pendingAdmission) break;
3443 + }
3444 + if (state.activeTurn !== turn || turn.finalized || turn.interrupted) {
3445 + return yield* protocolError(
3446 + `OpenCode turn ${steerInput.providerTurnId} is not active`,
3447 + );
3448 + }
3449 turn.admissionGeneration = state.nextAdmissionGeneration++;
3425 - turn.admissionMessageId = yield* makeOpenCodeMessageId(messageIdClock);
3450 + turn.admissionMessageId = admissionMessageId;
3451 turn.admissionPending = true;
3452 turn.admissionAccepted = false;
3453 turn.admissionMessageObserved = false;
@@ -3457,7 +3482,7 @@ export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function
3482 ]).pipe(Effect.asVoid),
3483 ),
3484 );
3460 - if (state.activeTurn === turn && !turn.finalized) {
3485 + if (state.activeTurn === turn && !turn.finalized && !turn.interrupted) {
3486 const admissionAction = advanceOpenCodePromptAdmission(turn, "accepted");
3487 if (admissionAction === "reconcile-idle") {
3488 yield* reconcilePromptAdmission(state, turn);
packages/provider-opencode/src/server/status.test.ts
+47
@@ -15,6 +15,7 @@ import * as Tracer from "effect/Tracer";
15 import * as HttpClient from "effect/http/HttpClient";
16 import * as HttpClientResponse from "effect/http/HttpClientResponse";
17 import { beforeEach } from "vite-plus/test";
18 +import { buildProviderOptionSelectionsFromDescriptors } from "@t3tools/shared/model";
19 import { settingsSecretLiteral } from "@t3tools/contracts";
20
21 import { OpenCodeSettings } from "../settings.ts";
@@ -684,6 +685,52 @@ it.layer(layerTest)("checkOpenCodeProviderStatus", (it) => {
685 }),
686 );
687
688 + it.effect("keeps Agent without inventing Reasoning for models with no variants", () =>
689 + Effect.gen(function* () {
690 + runtimeMock.state.inventory = {
691 + providerList: {
692 + connected: ["opencode"],
693 + all: [
694 + {
695 + id: "opencode",
696 + name: "OpenCode Zen",
697 + models: {
698 + "big-pickle": { id: "big-pickle", name: "Big Pickle", variants: {} },
699 + "glm-5": { id: "glm-5", name: "GLM-5" },
700 + },
701 + },
702 + ],
703 + default: {},
704 + },
705 + agents: [
706 + { name: "build", hidden: false, mode: "primary" },
707 + { name: "plan", hidden: false, mode: "primary" },
708 + ],
709 + };
710 + const snapshot = yield* checkProvider(makeOpenCodeSettings());
711 + for (const slug of ["opencode/big-pickle", "opencode/glm-5"]) {
712 + const model = snapshot.models.find((entry) => entry.slug === slug);
713 + NodeAssert.ok(model);
714 + const descriptors = model.capabilities?.optionDescriptors;
715 + NodeAssert.deepEqual(descriptors, [
716 + {
717 + id: "agent",
718 + label: "Agent",
719 + type: "select",
720 + options: [
721 + { id: "build", label: "Build", isDefault: true },
722 + { id: "plan", label: "Plan" },
723 + ],
724 + currentValue: "build",
725 + },
726 + ]);
727 + NodeAssert.deepEqual(buildProviderOptionSelectionsFromDescriptors(descriptors), [
728 + { id: "agent", value: "build" },
729 + ]);
730 + }
731 + }),
732 + );
733 +
734 it.effect("includes OpenCode skills in the provider snapshot", () =>
735 Effect.gen(function* () {
736 runtimeMock.state.inventory = {
packages/provider-opencode/src/server/status.ts
+1 -3
@@ -234,9 +234,7 @@ function openCodeCapabilitiesForModel(input: {
234 readonly model: ProviderListResponse["all"][number]["models"][string];
235 readonly agents: ReadonlyArray<Agent>;
236 }): ModelCapabilities {
237 - const rawVariantValues = Object.keys(input.model.variants ?? {});
238 - const variantValues =
239 - rawVariantValues.length > 0 ? rawVariantValues : ["low", "medium", "high", "xhigh"];
237 + const variantValues = Object.keys(input.model.variants ?? {});
238 const defaultVariant = inferDefaultVariant(input.providerID, variantValues);
239 const variantOptions = variantValues.map((value) =>
240 defaultVariant === value
packages/provider-opencode/src/server/textGeneration.test.ts
+37 -2
@@ -1,5 +1,6 @@
1 import { ProviderInstanceId, settingsSecretLiteral, TextGenerationError } from "@t3tools/contracts";
2 import { OpenCodeSettings } from "../settings.ts";
3 +import type { OpencodeClient } from "@opencode-ai/sdk/v2";
4 import * as NodeServices from "@effect/platform-node/NodeServices";
5 import { it } from "@effect/vitest";
6 import * as Cause from "effect/Cause";
@@ -25,6 +26,7 @@ const runtimeMock = {
26 startCalls: [] as string[],
27 promptUrls: [] as string[],
28 promptParts: [] as ReadonlyArray<unknown>[],
29 + promptInputs: [] as Array<Parameters<OpencodeClient["session"]["prompt"]>[0]>,
30 authHeaders: [] as Array<string | null>,
31 closeCalls: [] as string[],
32 sessionCreateCalls: 0,
@@ -46,6 +48,7 @@ const runtimeMock = {
48 this.state.startCalls.length = 0;
49 this.state.promptUrls.length = 0;
50 this.state.promptParts.length = 0;
51 + this.state.promptInputs.length = 0;
52 this.state.authHeaders.length = 0;
53 this.state.closeCalls.length = 0;
54 this.state.sessionCreateCalls = 0;
@@ -106,6 +109,13 @@ const OpenCodeRuntimeTestDouble: OpenCodeRuntime.OpenCodeRuntime["Service"] = {
109 runOpenCodeCommand: () => Effect.succeed({ stdout: "", stderr: "", code: 0 }),
110 createOpenCodeSdkClient: ({ baseUrl, serverPassword }) =>
111 ({
112 + provider: {
113 + list: async () => ({
114 + data: {
115 + all: [{ id: "openai", models: { "gpt-5": { id: "gpt-5" } } }],
116 + },
117 + }),
118 + },
119 session: {
120 create: async (_input: unknown, options?: { readonly signal?: AbortSignal }) => {
121 runtimeMock.state.sessionCreateCalls += 1;
@@ -130,11 +140,12 @@ const OpenCodeRuntimeTestDouble: OpenCodeRuntime.OpenCodeRuntime["Service"] = {
140 return { data: true };
141 },
142 prompt: async (
133 - input: { readonly parts: ReadonlyArray<unknown> },
143 + input: Parameters<OpencodeClient["session"]["prompt"]>[0],
144 options?: { readonly signal?: AbortSignal },
145 ) => {
146 + runtimeMock.state.promptInputs.push(input);
147 runtimeMock.state.promptUrls.push(baseUrl);
137 - runtimeMock.state.promptParts.push(input.parts);
148 + runtimeMock.state.promptParts.push(input.parts ?? []);
149 runtimeMock.state.authHeaders.push(
150 serverPassword ? `Basic ${btoa(`opencode:${serverPassword}`)}` : null,
151 );
@@ -250,6 +261,30 @@ const advanceIdleClock = Effect.gen(function* () {
261 });
262
263 it.layer(layerOpenCodeTextGenerationTest)("OpenCodeTextGeneration", (it) => {
264 + it.effect("omits stale reasoning variants when generating commit messages", () =>
265 + withOpenCodeTextGeneration(DEFAULT_OPENCODE_SETTINGS, (textGeneration) =>
266 + Effect.gen(function* () {
267 + yield* textGeneration.generateCommitMessage({
268 + ...DEFAULT_COMMIT_MESSAGE_INPUT,
269 + modelSelection: {
270 + ...DEFAULT_TEST_MODEL_SELECTION,
271 + options: [
272 + { id: "variant", value: "medium" },
273 + { id: "agent", value: "plan" },
274 + ],
275 + },
276 + });
277 +
278 + expect(runtimeMock.state.promptInputs).toHaveLength(1);
279 + expect(runtimeMock.state.promptInputs[0]).toMatchObject({
280 + model: { providerID: "openai", modelID: "gpt-5" },
281 + agent: "plan",
282 + });
283 + expect(runtimeMock.state.promptInputs[0]).not.toHaveProperty("variant");
284 + }),
285 + ),
286 + );
287 +
288 it.effect("cancels or times out an in-flight session creation before prompting", () =>
289 withOpenCodeTextGeneration(EXISTING_SERVER_OPENCODE_SETTINGS, (textGeneration) =>
290 Effect.gen(function* () {
packages/provider-opencode/src/server/textGeneration.ts
+5 -1
@@ -240,7 +240,11 @@ export const makeOpenCodeTextGeneration = Effect.fn("makeOpenCodeTextGeneration"
240 ).pipe(Effect.timeout("5 seconds"), Effect.ignore({ log: "Warn" })),
241 );
242 const selectedAgent = getModelSelectionStringOptionValue(input.modelSelection, "agent");
243 - const selectedVariant = getModelSelectionStringOptionValue(input.modelSelection, "variant");
243 + const selectedVariant = yield* OpenCodeRuntime.resolveOpenCodeVariant(
244 + client,
245 + parsedModel,
246 + getModelSelectionStringOptionValue(input.modelSelection, "variant"),
247 + );
248 const promptContext = {
249 operation: input.operation,
250 cwd: input.cwd,