From 0dbc1e2610c80c624466ebbd855ed20aec5cdedd Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Thu, 12 Nov 2026 01:17:57 -0800 Subject: [PATCH] fix(agent-picker): hide a short name only on reported proof; keep hidden rows searchable --- .../input/MobileNativeChatSessionOptionRows.tsx | 7 ++++--- .../agent/agent-launch-setup-option-rows.ts | 4 ++-- .../options/controls/NativeChatModelCombobox.tsx | 5 +++-- .../picker/agent-launch-picker-search.ts | 3 --- .../agent-launch/picker/agent-launch-picker.ts | 6 +++++- src/shared/legacy-agent-models.ts | 8 ++++---- .../input/native-chat-session-option-snapshot.ts | 16 +++++++--------- .../input/native-chat-session-options.ts | 2 ++ 8 files changed, 27 insertions(+), 24 deletions(-) diff --git a/mobile/src/session/native-chat/input/MobileNativeChatSessionOptionRows.tsx b/mobile/src/session/native-chat/input/MobileNativeChatSessionOptionRows.tsx index 00dbbe2b6dc..1731e99ac39 100644 --- a/mobile/src/session/native-chat/input/MobileNativeChatSessionOptionRows.tsx +++ b/mobile/src/session/native-chat/input/MobileNativeChatSessionOptionRows.tsx @@ -221,10 +221,11 @@ export function descriptorRowElements( onPress={() => onSetOption(choice.value)} /> ) - // No search here: search-only aliases follow a More models toggle, as compact pickers show them. - const more = moreChoices ? choices.filter((choice) => choice.legacy) : [] + // No search here, so search-only rows stay out; folded ones follow a More models toggle. + const listed = choices.filter((choice) => !choice.hidden) + const more = moreChoices ? listed.filter((choice) => choice.legacy) : [] return [ - ...choices.filter((choice) => !choice.legacy).map(choiceRow), + ...listed.filter((choice) => !choice.legacy).map(choiceRow), ...(more.length > 0 && moreChoices ? [ ...(moreChoices.shown ? more.map(choiceRow) : []), diff --git a/src/renderer/src/components/agent/agent-launch-setup-option-rows.ts b/src/renderer/src/components/agent/agent-launch-setup-option-rows.ts index 92374f38b70..cdc420e1727 100644 --- a/src/renderer/src/components/agent/agent-launch-setup-option-rows.ts +++ b/src/renderer/src/components/agent/agent-launch-setup-option-rows.ts @@ -277,8 +277,8 @@ export function agentLaunchSetupModelRows( modelInArguments: boolean ) { type Row = { id: string; label: string; unlisted?: true } - // A hidden row stays listed while it is the current choice. - const listed = models.filter((model) => !model.hidden || model.id === currentModel) + // A hidden row is listed by a matching search, or while it is the current choice. + const listed = models.filter((model) => !model.hidden || query || model.id === currentModel) // Membership ignores the selection, so picking a model never moves rows in the open list. const folded = (model: AgentPickerModel) => !query && Boolean(model.isLegacy) const rows: Row[] = listed.filter((model) => !folded(model)) diff --git a/src/renderer/src/components/native-chat/session/options/controls/NativeChatModelCombobox.tsx b/src/renderer/src/components/native-chat/session/options/controls/NativeChatModelCombobox.tsx index b592d2c5d55..6326a28abd6 100644 --- a/src/renderer/src/components/native-chat/session/options/controls/NativeChatModelCombobox.tsx +++ b/src/renderer/src/components/native-chat/session/options/controls/NativeChatModelCombobox.tsx @@ -55,7 +55,8 @@ export function NativeChatModelCombobox({ const searching = Boolean(query.trim()) // Membership ignores the selection, so picking a model never moves rows in the open list. const folded = (choice: SessionOptionSelectChoice) => !searching && Boolean(choice.legacy) - const legacyChoices = choices.filter(folded) + const listed = searching ? choices : choices.filter((choice) => !choice.hidden) + const legacyChoices = listed.filter(folded) const renderChoice = (choice: SessionOptionSelectChoice) => { const label = nativeChatSessionChoiceLabel(choice, say) const current = choice.value === currentValue @@ -114,7 +115,7 @@ export function NativeChatModelCombobox({ {/* One keyed array, so a row moving between sections keeps its highlight. */} {[ - ...choices.filter((choice) => !folded(choice)).map(renderChoice), + ...listed.filter((choice) => !folded(choice)).map(renderChoice), ...(legacyExpanded ? legacyChoices.map(renderChoice) : []), !score(word, agentWords) && score(word, modelWords))) { continue diff --git a/src/shared/agent-launch/picker/agent-launch-picker.ts b/src/shared/agent-launch/picker/agent-launch-picker.ts index ca1f3675565..4282ca199e4 100644 --- a/src/shared/agent-launch/picker/agent-launch-picker.ts +++ b/src/shared/agent-launch/picker/agent-launch-picker.ts @@ -21,7 +21,11 @@ import type { CurrentActionSelection } from '../../source-control/ai/recipes/sou export type AgentPickerSurface = 'chat' | 'terminal' export type AgentPickerDraftOwner = object -export type AgentPickerModel = AgentSessionModelOption & { isLegacy?: true; hidden?: true } +export type AgentPickerModel = AgentSessionModelOption & { + isLegacy?: true + /** Listed only by a matching search, or while it is the current choice. */ + hidden?: true +} export type AgentPickerEntry = { textGeneration?: TextActionPickerCatalog agent: TuiAgent diff --git a/src/shared/legacy-agent-models.ts b/src/shared/legacy-agent-models.ts index fe91be4ede9..69e56880469 100644 --- a/src/shared/legacy-agent-models.ts +++ b/src/shared/legacy-agent-models.ts @@ -52,9 +52,9 @@ function supersededCodexModels(models: readonly ListedModel[]): (model: ListedMo } } -// Proven by the row naming the versioned model it runs, or, where a saved list or older host -// dropped that, by a versioned row of the same family (opus beside claude-opus-5-5). Only a -// family short name (opus, opus[1m]) is that model; other names (opusplan) only fold. +// Hidden only when the row names the versioned model it runs and is that family's short name +// (opus → claude-opus-5-5). Other covered names (opusplan) and rows a saved list or older host +// lists without that proof (opus beside claude-opus-5-5) only fold. function coveredClaudeAliases(models: readonly ListedModel[]): (model: ListedModel) => ModelClass { const selfResolved = new Set() const versionedFamilies = new Set() @@ -77,7 +77,7 @@ function coveredClaudeAliases(models: readonly ListedModel[]): (model: ListedMod } return family && claudeVersionedFamily(resolved) === family ? 'hidden' : 'legacy' } - return family && versionedFamilies.has(family) ? 'hidden' : null + return family && versionedFamilies.has(family) ? 'legacy' : null } } diff --git a/src/shared/native-chat/input/native-chat-session-option-snapshot.ts b/src/shared/native-chat/input/native-chat-session-option-snapshot.ts index eed1765c8cb..a966a023e51 100644 --- a/src/shared/native-chat/input/native-chat-session-option-snapshot.ts +++ b/src/shared/native-chat/input/native-chat-session-option-snapshot.ts @@ -233,15 +233,13 @@ export function nativeChatSessionOptionDescriptors(args: { // Callers reconcile tracked models into choices first; the trigger must never show an unlisted selection. // Legacy rows fold away like the launch picker's; a picker opens the section when the chat is on one. const { legacy, hidden } = classifyAgentModels(agent, args.legacyInventory ?? models) - // A hidden row stays listed while the chat is on it. - const modelChoices = models - .filter(({ id }) => !hidden.has(id) || id === model.currentId) - .map(({ id, label, description }) => ({ - value: id, - label, - ...(description ? { description } : {}), - ...(legacy.has(id) ? { legacy: true as const } : {}) - })) + const modelChoices = models.map(({ id, label, description }) => ({ + value: id, + label, + ...(description ? { description } : {}), + ...(legacy.has(id) ? { legacy: true as const } : {}), + ...(hidden.has(id) && id !== model.currentId ? { hidden: true as const } : {}) + })) const modelAction = actionForApply(catalog.modelApply, model.tracked, mode, liveTransport) const snapshot: SessionOptionDescriptor[] = [ { diff --git a/src/shared/native-chat/input/native-chat-session-options.ts b/src/shared/native-chat/input/native-chat-session-options.ts index b11aa7bcf1c..b4e8c887fab 100644 --- a/src/shared/native-chat/input/native-chat-session-options.ts +++ b/src/shared/native-chat/input/native-chat-session-options.ts @@ -8,6 +8,8 @@ export type SessionOptionSelectChoice = { description?: string /** Folded under More models; a matching search still lists it. */ legacy?: true + /** Listed only by a matching search; never set on the current choice. */ + hidden?: true } /** default describes catalog display, never running-agent evidence. dispatched is sent but unread and may be corrected by reports.