fix(cli): show model display names in picker - #3493
Conversation
Generated-by: OpenCode
Generated-by: OpenCode
Generated-by: OpenCode
|
Nice cleanup — the projection via One substantive nit before merge: the model-id match criterion lost its dedicated test case, so one line of The five-case list previously isolated each match criterion one-by-one; - { query: 'gpt', keep: 'gpt-5.5', drop: ['glm-max', 'text-unicorn'] },
+ { query: 'preview', keep: 'GPT 5.5 Preview', drop: ['GLM Max', 'text-unicorn'] },After the swap, every remaining query is satisfied by other lines: function matchesModelChoice(choice: ModelChoice, query: string): boolean {
if (choice.model.toLowerCase().includes(query)) return true; // ← now unpinned
if (choice.displayName?.toLowerCase().includes(query)) return true; // 'preview' hits here
if (choice.connectionName.toLowerCase().includes(query)) return true; // 'aurora'
if (choice.connectionSlug.toLowerCase().includes(query)) return true; // 'alpha'
if (choice.providerType.toLowerCase().includes(query)) return true; // 'zai'
const providerLabel = PROVIDER_DEFAULTS[choice.providerType]?.label; // 'gemini'
...
}Deleting the Suggested fix — add an id-only query whose substring does not occur in any display name: // 'glm-max' occurs in the model id but not in the display name ('GLM Max'),
// so this case can only pass through the model-id criterion.
{ query: 'glm-max', keep: 'GLM Max', drop: ['GPT 5.5 Preview', 'text-unicorn'] },(Optionally also assert the inverse rendering invariant somewhere — that a choice with a |
Generated-by: OpenCode
Astro-Han
left a comment
There was a problem hiding this comment.
Approving 141534485a0addc6a2747d3b6bc7cb55e428916c. Required test is completed / success bound to that exact SHA. No P0–P3.
One note on how this got here: CI had never run on this head — zero check runs, one workflow sitting at action_required. That state renders like "in progress" and is easy to misread as pending; it was approved as a maintainer and is green now. Flagging it because it was the reviewing line that caught it rather than assuming the absence of a red mark meant a green one.
What was verified:
displayNameis a projection, never an identity. The picker still carriesvalue: String(index)and resolves back to theModelChoice;modelremains the authoritative key anddisplayNameonly reacheslabel. Nothing selects, persists, or matches on the display name.- One source, one lookup.
modelsById.get(model)?.displayNamereads from the same catalog object asmodel, in the same lookup — not a second fetch that could disagree with it. Two call sites, no third copy. - The fallback is
displayName?.trim() || choice.model. The.trim()matters: a catalog entry with a whitespace-only display name falls back to the id rather than rendering a blank row.??would not have.
The part worth calling out is the one that is not cosmetic. This also widens search matching — if (choice.displayName?.toLowerCase().includes(query)) return true; — and correspondingly updates the comment that used to say ModelChoice carries no display name so the id is the only model-side match target. This is the one place where display names cross out of presentation and into behavior, so it deserves to be described as such rather than folded into "show display names."
Good that { query: 'glm-max', keep: 'GLM Max' } was added alongside the display-name queries: it pins that widening the match surface did not displace plain id matching, which is the regression this change could plausibly have introduced.
Reviewed at 2026-08-23 12:55 UTC.
Summary
The cross-connection TUI
/modelpicker now prefers each catalog model’s human-readabledisplayName, while retaining the raw model id when no display name is available. Search matches both model ids and display names.Fixes #3482
Verification
npm --workspace maka-agent test(372 tests passed)npm --workspace maka-agent run typechecknpx biome lint packages/cli/src/pi-tui-contracts.ts packages/cli/src/runtime-host-onboarding.ts packages/cli/src/pi-tui-pickers.ts packages/cli/src/__tests__/runtime-host-onboarding.test.ts packages/cli/src/__tests__/pi-tui-runner.test.tsnpx biome format packages/cli/src/pi-tui-contracts.ts packages/cli/src/runtime-host-onboarding.ts packages/cli/src/pi-tui-pickers.ts packages/cli/src/__tests__/runtime-host-onboarding.test.ts packages/cli/src/__tests__/pi-tui-runner.test.tsThe TUI runner test covers display-name rendering, id fallback, and searching by the displayed model name.
AI use
Tool(s) and scope: OpenCode made the code and test changes, reviewed the implementation, and ran the verification commands.
Checklist
Does this PR entail a change in behavior?