Skip to content

The open-source app everyone uses to manage agents at work

fix(ui): use available space for composer labels (#15050)

Dotta1c3abf507530
diff --git a/ui/src/components/task-chat/ComposerRunSettingsPicker.test.tsx b/ui/src/components/task-chat/ComposerRunSettingsPicker.test.tsx
index e09a165b4c..3185f1d905 100644
--- a/ui/src/components/task-chat/ComposerRunSettingsPicker.test.tsx
+++ b/ui/src/components/task-chat/ComposerRunSettingsPicker.test.tsx
@@ -55,6 +55,21 @@ afterEach(() => {
});
describe("composer assignee picker", () => {
+ it("lets the assignee and model use the available composer width", () => {
+ render(vi.fn(), vi.fn());
+ const trigger = container!.querySelector<HTMLButtonElement>('[data-testid="task-chat-composer-assignee"]');
+ const assignee = trigger!.querySelector('[data-testid="task-chat-composer-assignee-label"]');
+ const model = trigger!.querySelector('[data-testid="task-chat-composer-model-label"]');
+
+ expect(trigger?.className).toContain("max-w-full");
+ expect(trigger?.className).not.toContain("max-w-64");
+ expect(assignee?.className).toContain("min-w-0");
+ expect(assignee?.className).not.toContain("max-w-24");
+ expect(model?.className).toContain("min-w-0");
+ expect(assignee?.className).toContain("truncate");
+ expect(model?.className).toContain("truncate");
+ });
+
it("finds assignees by their displayed role and harness", async () => {
render(vi.fn(), vi.fn());
await click("Select assignee, model and effort");
diff --git a/ui/src/components/task-chat/ComposerRunSettingsPicker.tsx b/ui/src/components/task-chat/ComposerRunSettingsPicker.tsx
index f3b6025126..63f42235d2 100644
--- a/ui/src/components/task-chat/ComposerRunSettingsPicker.tsx
+++ b/ui/src/components/task-chat/ComposerRunSettingsPicker.tsx
@@ -167,10 +167,10 @@ export function ComposerRunSettingsPicker({
const reset = () => onSettingsChange(DEFAULT_COMPOSER_RUN_SETTINGS);
const closeButton = mobile ? <DialogClose asChild><button type="button" aria-label="Close picker" className="grid size-8 place-items-center rounded-md text-muted-foreground hover:bg-accent"><X className="size-4" /></button></DialogClose> : null;
const trigger = <button ref={triggerRef} type="button" disabled={disabled} aria-label="Select assignee, model and effort" data-testid="task-chat-composer-assignee"
- className="flex h-8 min-w-0 max-w-64 items-center gap-1.5 rounded-full bg-muted px-2.5 text-xs font-medium hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50">
+ className="flex h-8 min-w-0 max-w-full items-center gap-1.5 rounded-full bg-muted px-2.5 text-xs font-medium hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50">
{renderAssigneeIdentity?.(assigneeValue, agent?.name ?? "Unassigned", "trigger")}
- <span className="max-w-24 truncate">{assigneeOptions.find((item) => item.id === assigneeValue)?.label ?? "Unassigned"}</span>
- <span className="text-muted-foreground" aria-hidden>·</span><span className="min-w-0 truncate text-muted-foreground">{modelSupported ? modelName || "Harness default" : "Harness default"}</span>
+ <span data-testid="task-chat-composer-assignee-label" className="min-w-0 truncate">{assigneeOptions.find((item) => item.id === assigneeValue)?.label ?? "Unassigned"}</span>
+ <span className="text-muted-foreground" aria-hidden>·</span><span data-testid="task-chat-composer-model-label" className="min-w-0 truncate text-muted-foreground">{modelSupported ? modelName || "Harness default" : "Harness default"}</span>
{effort ? <span className="hidden shrink-0 text-muted-foreground sm:inline">{effortLabel}</span> : null}
<ChevronDown className="size-3 shrink-0 text-muted-foreground" aria-hidden />
</button>;
diff --git a/ui/storybook/prototypes/composer-model-picker/fixtures.ts b/ui/storybook/prototypes/composer-model-picker/fixtures.ts
index c194f2b773..2ea83b9771 100644
--- a/ui/storybook/prototypes/composer-model-picker/fixtures.ts
+++ b/ui/storybook/prototypes/composer-model-picker/fixtures.ts
@@ -86,6 +86,9 @@ export const composerAgents: ComposerAgent[] = [
{ id: "kimi-code/kimi-for-coding", label: "K2.8 Preview" },
{ id: "kimi-code/k3", label: "K3" },
], manualPattern: "kimi-code/model" },
+ { id: "long-labels", name: "Alexandra Engineering Coordinator", role: "Engineering", harness: "Codex", adapterType: "codex_local", defaultModel: "gpt-5.6-sol", models: [
+ { id: "gpt-5.6-sol", label: "GPT-5.6 Sol Extended Context Preview", detail: "Agent default" },
+ ], manualPattern: "Model ID, e.g. gpt-5.6-sol" },
];
/** Share the capsule-avatar palettes used by the agent persona stories. */
diff --git a/ui/storybook/stories/composer-model-picker.stories.tsx b/ui/storybook/stories/composer-model-picker.stories.tsx
index dbe7cf8c05..391eddb75c 100644
--- a/ui/storybook/stories/composer-model-picker.stories.tsx
+++ b/ui/storybook/stories/composer-model-picker.stories.tsx
@@ -414,3 +414,27 @@ export const ProductionIntermediateWidthPlan: Story = {
await expect(screen.getByTestId("composer-model-popover")).toBeVisible();
},
};
+
+export const ProductionLongLabelsWide: Story = {
+ name: "25 · Long labels with available space",
+ render: () => <ComposerRunSettingsLiveStory agentId="long-labels" />,
+ play: async ({ canvasElement }) => {
+ const screen = within(canvasElement.ownerDocument.body);
+ const assignee = screen.getByTestId("task-chat-composer-assignee-label");
+ const model = screen.getByTestId("task-chat-composer-model-label");
+ await expect(assignee.scrollWidth).toBeLessThanOrEqual(assignee.clientWidth);
+ await expect(model.scrollWidth).toBeLessThanOrEqual(model.clientWidth);
+ },
+};
+
+export const ProductionLongLabelsConstrained: Story = {
+ name: "25b · Long labels constrained by Plan mode",
+ render: () => <ComposerRunSettingsLiveStory agentId="long-labels" compact initialMode="planning" />,
+ play: async ({ canvasElement }) => {
+ const screen = within(canvasElement.ownerDocument.body);
+ const assignee = screen.getByTestId("task-chat-composer-assignee-label");
+ const model = screen.getByTestId("task-chat-composer-model-label");
+ await expect(assignee.scrollWidth > assignee.clientWidth || model.scrollWidth > model.clientWidth).toBe(true);
+ await expect(screen.getByRole("button", { name: "Remove Plan mode" })).toBeVisible();
+ },
+};