TypeScript
fix(mobile): show OpenCode model sources in picker (#8573)
Julius Marmingeacb599d2dc5b
diff --git a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsxindex 66e7f36ec3e..02f69f3544c 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 (<Pressable- accessibilityLabel={props.option.label}+ accessibilityLabel={[props.option.label, props.option.subtitle].filter(Boolean).join(", ")}accessibilityRole="radio"accessibilityState={{ checked: props.selected }}onPress={props.onPress}@@ -103,20 +103,31 @@ function ModelRow(props: {props.isLast ? "rounded-b-2xl" : "border-b border-border-subtle",)}>- <Text className="min-w-0 shrink text-base font-t3-medium text-foreground" numberOfLines={1}>- {props.option.label}- </Text>- {props.option.isDefault ? (- <View className="rounded-md bg-subtle-strong px-1.5 py-0.5">- <Text className="text-3xs font-t3-bold text-foreground-muted">Default</Text>- </View>- ) : null}- {props.option.isLegacy ? (- <View className="rounded-md bg-subtle px-1.5 py-0.5">- <Text className="text-3xs font-t3-bold text-foreground-muted">Legacy</Text>+ <View className="min-w-0 flex-1">+ <View className="flex-row items-center gap-2">+ <Text+ className="min-w-0 shrink text-base font-t3-medium text-foreground"+ numberOfLines={1}+ >+ {props.option.label}+ </Text>+ {props.option.isDefault ? (+ <View className="rounded-md bg-subtle-strong px-1.5 py-0.5">+ <Text className="text-3xs font-t3-bold text-foreground-muted">Default</Text>+ </View>+ ) : null}+ {props.option.isLegacy ? (+ <View className="rounded-md bg-subtle px-1.5 py-0.5">+ <Text className="text-3xs font-t3-bold text-foreground-muted">Legacy</Text>+ </View>+ ) : null}</View>- ) : null}- <View className="flex-1" />+ {props.option.subtitle ? (+ <Text className="text-xs text-foreground-muted" numberOfLines={1}>+ {props.option.subtitle}+ </Text>+ ) : null}+ </View>{props.selected ? (<SymbolViewname="checkmark"diff --git a/apps/mobile/src/features/threads/thread-settings-sheet-state.test.ts b/apps/mobile/src/features/threads/thread-settings-sheet-state.test.tsindex 2e8fee98572..5c6e25f4378 100644--- a/apps/mobile/src/features/threads/thread-settings-sheet-state.test.ts+++ b/apps/mobile/src/features/threads/thread-settings-sheet-state.test.ts@@ -12,7 +12,7 @@ function modelOption(return {key: `codex:${model}`,label: model,- subtitle: "Codex",+ subtitle: "",providerKey: "codex",providerLabel: "Codex",providerDriver: "codex",@@ -48,6 +48,21 @@ describe("thread settings sheet state", () => {).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.tsindex 8a9dabbe034..3da610cf247 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.tsindex cb7a8c4198e..9aadefbd8c1 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.mdindex 35d634556d8..21642bf8c10 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 orOn web and desktop, HEIC and HEIF photos are automatically converted to JPEG when you drag them intothe 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 skillsType `/` to open the command menu. Type `$` to find and add a skill. Skill rows show their source,