The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): model picker keeps names whole; provider labels its favorites once
Brooklyn Nicholson69fdbb7cdc7a
diff --git a/apps/desktop/src/app/chat/composer/model-pill.tsx b/apps/desktop/src/app/chat/composer/model-pill.tsxindex f152a732169..3753e18d6d9 100644--- a/apps/desktop/src/app/chat/composer/model-pill.tsx+++ b/apps/desktop/src/app/chat/composer/model-pill.tsx@@ -218,7 +218,7 @@ export function ModelPill({</Tip><DropdownMenuContentalign="end"- className="w-64 p-0"+ className="w-72 p-0"onCloseAutoFocus={event => {if (restoreSelection.current) {event.preventDefault()diff --git a/apps/desktop/src/app/shell/model-catalog-menu.test.tsx b/apps/desktop/src/app/shell/model-catalog-menu.test.tsxindex 61bf9a1095a..5ef59c5e6c0 100644--- a/apps/desktop/src/app/shell/model-catalog-menu.test.tsx+++ b/apps/desktop/src/app/shell/model-catalog-menu.test.tsx@@ -273,19 +273,49 @@ describe('the catalog owns favorite models', () => {renderMenu()- const rows = (await screen.findAllByText(/Gemini 2\.5/i)).map(node => node.closest('[role="menuitem"]')!)+ await screen.findByText(/Gemini 2\.5/i)- // The section label comes before the provider group heading (the LAST- // 'Google' text — the favorite row's provider chip paints one first).const label = screen.getByText('Favorites')- const googleTexts = screen.getAllByText('Google')- const googleHeading = googleTexts[googleTexts.length - 1]+ const googleHeading = screen.getByText('Google')expect(label.compareDocumentPosition(googleHeading) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()+ })++ it('names each provider once over its favorites when the section mixes providers', async () => {+ getGlobalModelOptions.mockResolvedValue({+ providers: [+ { models: ['gemini-3.1-pro', 'gemini-2.5-flash'], name: 'Google', slug: 'google' },+ { models: ['gemini-3.1-pro'], name: 'OpenRouter', slug: 'openrouter' }+ ]+ })+ // Starred out of provider order: the section still gathers each+ // provider's favorites under one label, in the order they were starred.+ toggleFavoriteModel('google', 'gemini-3.1-pro')+ toggleFavoriteModel('openrouter', 'gemini-3.1-pro')+ toggleFavoriteModel('google', 'gemini-2.5-flash')++ renderMenu()++ await screen.findByText('Favorites')++ const rows = screen.getAllByText(/Gemini (3\.1|2\.5)/).map(node => node.textContent)++ // One label per provider, never one per row, and each provider's+ // favorites sit together under it.+ expect(screen.getAllByText('Google')).toHaveLength(1)+ expect(screen.getAllByText('OpenRouter')).toHaveLength(1)+ expect(rows).toEqual(['Gemini 3.1 Pro', 'Gemini 2.5', 'Gemini 3.1 Pro'])+ })++ it('does not label the provider when every favorite shares one', async () => {+ toggleFavoriteModel('google', 'gemini-2.5-flash')++ renderMenu()++ await screen.findByText('Favorites')- // The provider chip names the row's provider, so two labs sharing a model- // id stay apart in the mixed section.- expect(rows.some(row => row.textContent?.includes('Google'))).toBe(true)+ // Only Google's own group heading, never a label inside Favorites.+ expect(screen.getAllByText('Google')).toHaveLength(1)})it('does not also list a favorite under its provider', async () => {diff --git a/apps/desktop/src/app/shell/model-catalog-menu.tsx b/apps/desktop/src/app/shell/model-catalog-menu.tsxindex c9f80b21150..0270b55e681 100644--- a/apps/desktop/src/app/shell/model-catalog-menu.tsx+++ b/apps/desktop/src/app/shell/model-catalog-menu.tsx@@ -4,6 +4,7 @@ import { useStore } from '@nanostores/react'import { useQuery } from '@tanstack/react-query'import {createContext,+ Fragment,type ReactElement,type ReactNode,useContext,@@ -347,6 +348,10 @@ export function ModelCatalogMenu({// listed twice in one open menu. Not while searching: a query lists every// match in its provider's place.const favoriteSet = useMemo(() => new Set(favoriteKeys), [favoriteKeys])+ // Favorites that mix providers name each provider once, as a quiet label+ // over its rows (two labs can serve the same model name). With one provider+ // the label would only repeat the section.+ const favoritesSpanProviders = new Set(favoriteRows.map(row => row.provider.slug)).size > 1const groups = useMemo(() =>@@ -719,22 +724,25 @@ export function ModelCatalogMenu({{favoriteRows.length > 0 ? (<DropdownMenuGroup className="py-0.5"><DropdownMenuLabel className={catalogGroupLabel}>{copy.favorites}</DropdownMenuLabel>- {favoriteRows.map(({ family, provider }) => (- <ModelFamilyRow- controller={controller}- current={current}- defaultEffort={defaultEffort}- family={family}- favorite- kbProps={kbRowProps(`${provider.slug}:${family.id}`)}- key={`${provider.slug}:${family.id}`}- loadingModels={loadingModels}- onSelect={selectFamily}- onSubOpenChange={handleSubOpenChange}- provider={provider}- search={search}- showProvider- />+ {favoriteRows.map(({ family, provider }, index) => (+ <Fragment key={`${provider.slug}:${family.id}`}>+ {favoritesSpanProviders && favoriteRows[index - 1]?.provider.slug !== provider.slug ? (+ <DropdownMenuLabel className={favoriteProviderLabel}>{provider.name}</DropdownMenuLabel>+ ) : null}+ <ModelFamilyRow+ controller={controller}+ current={current}+ defaultEffort={defaultEffort}+ family={family}+ favorite+ kbProps={kbRowProps(`${provider.slug}:${family.id}`)}+ loadingModels={loadingModels}+ onSelect={selectFamily}+ onSubOpenChange={handleSubOpenChange}+ provider={provider}+ search={search}+ />+ </Fragment>))}</DropdownMenuGroup>) : null}@@ -901,8 +909,10 @@ interface FavoriteRow {}/** Resolve stored favorites into paintable rows, in the order the user- * starred them. A key with no family in THIS catalog yields no row — and is- * not dropped, so it comes back when its provider reconnects. */+ * starred them, gathered under the provider each first appeared with so the+ * section can name a provider once rather than on every row. A key with no+ * family in THIS catalog yields no row — and is not dropped, so it comes back+ * when its provider reconnects. */function resolveFavoriteRows(providers: readonly ModelOptionProvider[], keys: readonly string[]): FavoriteRow[] {const byKey = new Map<string, FavoriteRow>()@@ -912,11 +922,17 @@ function resolveFavoriteRows(providers: readonly ModelOptionProvider[], keys: re}}- return keys.flatMap(key => {+ const byProvider = new Map<string, FavoriteRow[]>()++ for (const key of keys) {const row = byKey.get(key)- return row ? [row] : []- })+ if (row) {+ byProvider.set(row.provider.slug, [...(byProvider.get(row.provider.slug) ?? []), row])+ }+ }++ return [...byProvider.values()].flat()}interface ModelFamilyRowProps {@@ -936,9 +952,6 @@ interface ModelFamilyRowProps {onSubOpenChange?: (open: boolean, key: string) => voidprovider: ModelOptionProvidersearch: string- /** Name the provider on the row. On in the Favorites section, where rows- * from every provider sit together and two labs can share a model name. */- showProvider?: boolean}/** One model family row: the favorite star, the trigger that commits the@@ -956,8 +969,7 @@ function ModelFamilyRow({onSelect,onSubOpenChange,provider,- search,- showProvider+ search}: ModelFamilyRowProps): ReactElement {const { t } = useI18n()const copy = t.shell.modelMenu@@ -1003,19 +1015,19 @@ function ModelFamilyRow({effFast)- // Row meta (provider, variant tag, fast mode, reasoning effort) renders as- // discrete badge chips BESIDE the name — not appended to it — so "High"- // reads as the model's reasoning setting, never as part of a differently-- // named model. The provider chip only paints in the Favorites section,- // where rows from every provider sit together.- const metaTags = [- showProvider ? provider.name : null,- tag || null,+ // Identity on the left, settings on the right. The name and its variant tag+ // (`…-flash`, `…-preview`: WHICH model) lead; fast and effort are how this+ // row is SET, so they sit by the caret that edits them instead of queueing+ // after the name (#130349). The provider is never a per-row chip; a mixed+ // Favorites section names it once over its rows. An inherited effort would+ // be the same chip on every row, so it shows only on the active model and+ // on a row whose remembered preset chose one.+ const settings = [fastControl.kind !== 'none' && fastControl.on ? copy.fast : null,- (caps?.reasoning ?? true) && !(isCurrent && current.effortPending)+ (caps?.reasoning ?? true) && (isCurrent ? !current.effortPending : Boolean(effEffort))? reasoningEffortLabel(effEffort || defaultEffort, isCurrent ? current.effortWire : undefined): null- ].filter((chip): chip is string => Boolean(chip))+ ].filter((setting): setting is string => Boolean(setting))// Clicking the row commits the model and closes; the edit submenu// (reasoning/fast) is reached by HOVER, so you can tweak those without@@ -1091,11 +1103,7 @@ function ModelFamilyRow({<span className="min-w-0 truncate"><HighlightMatches foldSeparators query={search} text={name} /></span>- {metaTags.map(chip => (- <Badge className="shrink-0 uppercase tracking-wide" key={chip} size="xs" variant="muted">- {chip}- </Badge>- ))}+ {tag ? <ModelChip>{tag}</ModelChip> : null}{decoration.badge ? (<Badge className="shrink-0 uppercase tracking-wide" data-model-menu-row-badge="" size="xs" variant="muted">{decoration.badge}@@ -1103,7 +1111,7 @@ function ModelFamilyRow({) : null}</span>{loadProgress ? (- <span className="ml-auto flex shrink-0 items-center gap-1.5" title={copyPicker.loadingIntoMemory}>+ <span className="flex shrink-0 items-center gap-1.5" title={copyPicker.loadingIntoMemory}><span className="h-1 w-14 overflow-hidden rounded-full bg-(--ui-bg-tertiary)"><spanclassName="block h-full rounded-full bg-primary transition-[width] duration-500"@@ -1114,9 +1122,12 @@ function ModelFamilyRow({</span>) : null}{showPricing && pricing ? <ModelPrice pricing={pricing} /> : null}- {isCurrent ? (- <Codicon className={cn('text-foreground', loadProgress ? 'ml-1' : 'ml-auto')} name="check" size="0.75rem" />- ) : null}+ {settings.map(setting => (+ <ModelChip key={setting} setting>+ {setting}+ </ModelChip>+ ))}+ {isCurrent ? <Codicon className="text-foreground" name="check" size="0.75rem" /> : null}</DropdownMenuSubTrigger><ModelEditSubmenucanDisableReasoning={caps?.can_disable_reasoning ?? undefined}@@ -1153,6 +1164,22 @@ const LOCAL_PROVIDER_SLUG = 'llamacpp'const catalogGroupLabel ='px-2 pb-0.5 pt-0.5 text-[0.625rem] font-semibold uppercase tracking-wider text-(--ui-text-tertiary)'+// A provider inside a mixed Favorites section: the group heading's ink, set+// in normal case and indented to the model names it labels, so it reads as+// a sub-group rather than a sibling section.+const favoriteProviderLabel = 'pt-1.5 pb-0 pr-2 pl-7.75 text-[0.625rem] text-(--ui-text-tertiary)'++/** The picker's chips: a filled tag for what the model IS (its variant), an+ * outlined one for how this row is SET (fast, effort), so the two read as+ * different kinds of fact at a glance. */+function ModelChip({ children, setting = false }: { children: ReactNode; setting?: boolean }): ReactElement {+ return (+ <Badge className="shrink-0 uppercase tracking-wide" size="xs" variant={setting ? 'outline' : 'muted'}>+ {children}+ </Badge>+ )+}+// A model still downloading: visible so the user knows it's coming (and// where it will land), disabled so it can't be selected early, with the// same byte progress the Local Models pane shows. Percent is selected HERE,