Skip to content

The agent that grows with you

fix(desktop): stop capping the composer model pill width

Brooklyn Nicholson687c666adace
diff --git a/apps/desktop/src/app/chat/composer/model-pill.test.tsx b/apps/desktop/src/app/chat/composer/model-pill.test.tsx
index c25667a8276..d0502614350 100644
--- a/apps/desktop/src/app/chat/composer/model-pill.test.tsx
+++ b/apps/desktop/src/app/chat/composer/model-pill.test.tsx
@@ -168,6 +168,27 @@ describe('ModelPill per-surface model label', () => {
})
})
+// #49340: long model names ("DeepSeek V4 Flash · Med") were truncated with a
+// finite `max-w-*` cap even when the composer row had room to spare. The pill
+// now sizes to its content and only gives width back (shrink + min-w-0) under
+// real space pressure, so the label never clips unless the row is actually
+// out of room.
+describe('ModelPill width', () => {
+ it('imposes no finite width cap on the label', () => {
+ setCurrentModel('deepseek/deepseek-v4-flash')
+ $activeSessionId.set(null)
+
+ render(<ModelPill disabled={false} model={modelState({ model: 'deepseek/deepseek-v4-flash' })} />)
+
+ const pill = screen.getByRole('button')
+ expect(pill.className).not.toMatch(/\bmax-w-/)
+ // The squeeze path (collapse stages) still has to work: the pill must keep
+ // yielding width, not overflow the composer row.
+ expect(pill.className).toMatch(/\bmin-w-0\b/)
+ expect(pill.className).toMatch(/\bshrink\b/)
+ })
+})
+
// The `composer.modelPill` slot: a provider may override the pill's LABEL
// (compact reasoning label, custom naming) while the pill keeps its chrome,
// pin dot, and menu. A declining provider leaves the core label untouched.
diff --git a/apps/desktop/src/app/chat/composer/model-pill.tsx b/apps/desktop/src/app/chat/composer/model-pill.tsx
index 40a91bd7eb5..f152a732169 100644
--- a/apps/desktop/src/app/chat/composer/model-pill.tsx
+++ b/apps/desktop/src/app/chat/composer/model-pill.tsx
@@ -25,8 +25,11 @@ import type { ChatBarState } from './types'
// `shrink` (not `shrink-0`) with a truncating label: the pill is the one
// control in the row that can give width back continuously, so it absorbs the
// squeeze between collapse stages instead of pushing Send past the edge.
+// No `max-w-*` cap: the pill sizes to its label, so a long model name only
+// truncates when the row is genuinely out of room (#49340) — not at an
+// arbitrary 160px.
const PILL = cn(
- 'h-(--composer-control-size) min-w-0 max-w-40 shrink gap-1 rounded-md px-2 text-xs font-normal',
+ 'h-(--composer-control-size) min-w-0 shrink gap-1 rounded-md px-2 text-xs font-normal',
'text-(--ui-text-tertiary) hover:bg-(--chrome-action-hover) hover:text-foreground'
)