The best way to control Claude Code, Codex and more from any computer or phone
fix(opencode): show Reasoning selector for OpenCode models (#9287)
Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>
maria committed
Sep 2, 2026 at 20:27 UTC
dbc7bfa3f36cc61a3f1a2015e47d71ae9dee5421
3 files changed
+35
-5
apps/server/src/provider/Layers/OpenCodeProvider.ts
+33
-3
@@ -171,7 +171,30 @@ function inferDefaultAgent(agents: ReadonlyArray<Agent>): string | undefined {
171
}
172
173
const DEFAULT_OPENCODE_MODEL_CAPABILITIES: ModelCapabilities = createModelCapabilities({
174
- optionDescriptors: [],
174
+ optionDescriptors: [
175
+ {
176
+ id: "variant",
177
+ label: "Reasoning",
178
+ type: "select",
179
+ options: [
180
+ { id: "low", label: "Low" },
181
+ { id: "medium", label: "Medium", isDefault: true },
182
+ { id: "high", label: "High" },
183
+ { id: "xhigh", label: "Extra High" },
184
+ ],
185
+ currentValue: "medium",
186
+ },
187
+ {
188
+ id: "agent",
189
+ label: "Agent",
190
+ type: "select",
191
+ options: [
192
+ { id: "build", label: "Build", isDefault: true },
193
+ { id: "plan", label: "Plan" },
194
+ ],
195
+ currentValue: "build",
196
+ },
197
+ ],
198
});
199
200
function openCodeCapabilitiesForModel(input: {
@@ -179,7 +202,14 @@ function openCodeCapabilitiesForModel(input: {
202
readonly model: ProviderListResponse["all"][number]["models"][string];
203
readonly agents: ReadonlyArray<Agent>;
204
}): ModelCapabilities {
182
- const variantValues = Object.keys(input.model.variants ?? {});
205
+ const rawVariantValues = Object.keys(input.model.variants ?? {});
206
+ // When a model advertises no variants, synthesize the standard reasoning
207
+ // levels so the composer still offers a Reasoning selector (mirrors the
208
+ // Codex/Grok experience where reasoning is always configurable). The set
209
+ // covers the common OpenCode variant spectrum; `inferDefaultVariant`
210
+ // picks the provider-appropriate default (e.g. medium for openai/opencode).
211
+ const variantValues =
212
+ rawVariantValues.length > 0 ? rawVariantValues : ["low", "medium", "high", "xhigh"];
213
const defaultVariant = inferDefaultVariant(input.providerID, variantValues);
214
const variantOptions = variantValues.map((value) =>
215
defaultVariant === value
@@ -201,7 +231,7 @@ function openCodeCapabilitiesForModel(input: {
231
? [
232
{
233
id: "variant",
204
- label: "Variant",
234
+ label: "Reasoning",
235
type: "select" as const,
236
options: variantOptions,
237
...(defaultVariant ? { currentValue: defaultVariant } : {}),
apps/web/src/components/chat/TraitsPicker.test.ts
+1
-1
@@ -167,7 +167,7 @@ describe("buildUnavailableModelOptionDescriptors", () => {
167
).toEqual([
168
{
169
id: "variant",
170
- label: "Variant",
170
+ label: "Reasoning",
171
type: "select",
172
options: [{ id: "max", label: "max" }],
173
currentValue: "max",
apps/web/src/components/chat/TraitsPicker.tsx
+1
-1
@@ -40,7 +40,7 @@ const SAVED_OPTION_LABELS: Readonly<Record<string, string>> = {
40
agent: "Agent",
41
effort: "Effort",
42
reasoningEffort: "Reasoning effort",
43
- variant: "Variant",
43
+ variant: "Reasoning",
44
};
45
46
function savedOptionLabel(id: string): string {