From acb599d2dc5b28d5bad82fa2a280ac2abe771ec9 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Fri, 28 Aug 2026 12:37:15 -0700 Subject: [PATCH] fix(mobile): show OpenCode model sources in picker (#8573) Co-authored-by: Julius Marminge --- .../features/threads/ThreadSettingsSheet.tsx | 39 +++++++++----- .../thread-settings-sheet-state.test.ts | 17 ++++++- apps/mobile/src/lib/modelOptions.test.ts | 51 ++++++++++++++++++- apps/mobile/src/lib/modelOptions.ts | 4 +- docs/user/composer.md | 4 ++ 5 files changed, 97 insertions(+), 18 deletions(-) diff --git a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx index 66e7f36ec3..02f69f3544 100644 --- a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx +++ b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx @@ -93,7 +93,7 @@ function ModelRow(props: { }) { return ( - - {props.option.label} - - {props.option.isDefault ? ( - - Default + + + + {props.option.label} + + {props.option.isDefault ? ( + + Default + + ) : null} + {props.option.isLegacy ? ( + + Legacy + + ) : null} - ) : null} - {props.option.isLegacy ? ( - - Legacy - - ) : null} - + {props.option.subtitle ? ( + + {props.option.subtitle} + + ) : null} + {props.selected ? ( { ).toBe(true); }); + it("matches the upstream provider's display name", () => { + const model = { + ...modelOption("opencode/claude-fable-5"), + label: "Claude Fable 5", + subtitle: "OpenCode Zen", + }; + + expect(modelMatchesCatalogQuery({ model, providerLabel: "OpenCode", query: " ZEN " })).toBe( + true, + ); + expect(modelMatchesCatalogQuery({ model, providerLabel: "OpenCode", query: "copilot" })).toBe( + false, + ); + }); + it("clears staging when the applied model is pressed", () => { expect( pendingModelAfterPress({ diff --git a/apps/mobile/src/lib/modelOptions.test.ts b/apps/mobile/src/lib/modelOptions.test.ts index 8a9dabbe03..3da610cf24 100644 --- a/apps/mobile/src/lib/modelOptions.test.ts +++ b/apps/mobile/src/lib/modelOptions.test.ts @@ -44,13 +44,62 @@ describe("mobile model options", () => { providerKey: "codex", providerLabel: "Codex", models: [ - { key: "codex:gpt-5.6-sol", label: "GPT-5.6 Sol", isLegacy: false }, + { key: "codex:gpt-5.6-sol", label: "GPT-5.6 Sol", subtitle: "", isLegacy: false }, { key: "codex:gpt-5.4", label: "GPT-5.4", isLegacy: true }, ], }, ]); }); + it("distinguishes same-name OpenCode models without changing their routing", () => { + const sources = [ + { id: "anthropic", label: "Anthropic" }, + { id: "github-copilot", label: "GitHub Copilot" }, + { id: "opencode", label: "OpenCode Zen" }, + ]; + const config = { + providers: [ + { + instanceId: "opencode_work", + driver: "opencode", + displayName: "OpenCode Work", + enabled: true, + installed: true, + auth: { status: "authenticated" }, + models: sources.map((source) => ({ + slug: `${source.id}/claude-fable-5`, + name: "Claude Fable 5", + subProvider: source.label, + isCustom: false, + capabilities: null, + })), + }, + ], + } as unknown as ServerConfig; + const selection = { + instanceId: ProviderInstanceId.make("opencode_work"), + model: "github-copilot/claude-fable-5", + }; + + const options = buildModelOptions(config, selection); + + expect(options).toMatchObject( + sources.map((source) => ({ + key: `opencode_work:${source.id}/claude-fable-5`, + label: "Claude Fable 5", + subtitle: source.label, + providerLabel: "OpenCode Work", + selection: { + instanceId: "opencode_work", + model: `${source.id}/claude-fable-5`, + }, + })), + ); + expect(groupByProvider(options)).toEqual([ + { providerKey: "opencode_work", providerLabel: "OpenCode Work", models: options }, + ]); + }); + it("normalizes a legacy fallback selection against current capabilities", () => { const config = { providers: [ diff --git a/apps/mobile/src/lib/modelOptions.ts b/apps/mobile/src/lib/modelOptions.ts index cb7a8c4198..9aadefbd8c 100644 --- a/apps/mobile/src/lib/modelOptions.ts +++ b/apps/mobile/src/lib/modelOptions.ts @@ -121,7 +121,7 @@ export function buildModelOptions( options.set(key, { key, label: model.name, - subtitle: providerLabel, + subtitle: model.subProvider ?? "", providerKey: provider.instanceId, providerLabel, providerDriver: provider.driver, @@ -152,7 +152,7 @@ export function buildModelOptions( options.set(key, { key, label: fallbackModelSelection.model, - subtitle: providerLabel, + subtitle: "", providerKey: fallbackModelSelection.instanceId, providerLabel, providerDriver: fallbackModelSelection.instanceId, diff --git a/docs/user/composer.md b/docs/user/composer.md index 35d634556d..21642bf8c1 100644 --- a/docs/user/composer.md +++ b/docs/user/composer.md @@ -10,6 +10,10 @@ becomes available after every upload finishes. Failed uploads can be retried or On web and desktop, HEIC and HEIF photos are automatically converted to JPEG when you drag them into the composer or paste them into a message. +On mobile, the model picker shows each OpenCode model's upstream provider, such as Anthropic, +GitHub Copilot, or OpenCode Zen, beneath its name. Search by that provider name to narrow the list +when starting a thread or changing an existing thread's model. + ## Commands and skills Type `/` to open the command menu. Type `$` to find and add a skill. Skill rows show their source,