Skip to content

🙌 OpenHands: AI-Driven Development

fix(frontend): show full LLM model name on button and popover (#479)

Hiep Lec50fe2ace3c1
diff --git a/__tests__/components/features/chat/components/chat-input-model.test.tsx b/__tests__/components/features/chat/components/chat-input-model.test.tsx
index 8f7a67da48..91a5548d8d 100644
--- a/__tests__/components/features/chat/components/chat-input-model.test.tsx
+++ b/__tests__/components/features/chat/components/chat-input-model.test.tsx
@@ -29,7 +29,7 @@ describe("ChatInputModel", () => {
const model = screen.getByTestId("chat-input-llm-model");
expect(model).toBeInTheDocument();
- expect(model).toHaveTextContent("openai/gpt…");
+ expect(model).toHaveTextContent("openai/gpt-4o");
expect(model).toHaveAttribute("title", "openai/gpt-4o");
expect(screen.queryByTestId("chat-input-llm-model-popover")).not.toBeInTheDocument();
@@ -42,6 +42,32 @@ describe("ChatInputModel", () => {
expect(llmSettingsLink).toHaveAttribute("href", "/settings");
});
+ it("renders long model names in full on both the button and the popover", () => {
+ // Arrange — reproduces the bug-report scenario where a 24-char model name
+ // was previously rendered as "claude-son…" on the button and wrapped onto
+ // two lines inside the popover.
+ const longModel = "claude-sonnet-4-20250514";
+ useActiveConversationMock.mockReturnValue({
+ data: {
+ conversation_id: "test-conversation-id",
+ llm_model: longModel,
+ },
+ });
+
+ renderWithProviders(<ChatInputModel />);
+
+ // Act
+ const button = screen.getByTestId("chat-input-llm-model");
+ fireEvent.click(button);
+
+ // Assert — button shows the full name (no truncation),
+ // and the popover renders the same full string.
+ expect(button).toHaveTextContent(longModel);
+ expect(screen.getByTestId("chat-input-llm-model-popover")).toHaveTextContent(
+ longModel,
+ );
+ });
+
it("renders nothing when llm_model is missing", () => {
useActiveConversationMock.mockReturnValue({
data: { conversation_id: "test-conversation-id" },
diff --git a/src/components/features/chat/components/chat-input-actions.tsx b/src/components/features/chat/components/chat-input-actions.tsx
index 7bddd4a957..154dfe08cb 100644
--- a/src/components/features/chat/components/chat-input-actions.tsx
+++ b/src/components/features/chat/components/chat-input-actions.tsx
@@ -446,10 +446,10 @@ export function ChatInputActions({
>
<ContextMenu
testId="overflow-model-submenu"
- className="overflow-visible min-w-[220px] max-w-[320px]"
+ className="overflow-visible min-w-[220px]"
>
<li className="text-sm">
- <div className="p-2 leading-5 text-white break-all">
+ <div className="p-2 leading-5 text-white whitespace-nowrap">
{conversation?.llm_model}
</div>
</li>
diff --git a/src/components/features/chat/components/chat-input-model.tsx b/src/components/features/chat/components/chat-input-model.tsx
index 94598b0e41..249e87808d 100644
--- a/src/components/features/chat/components/chat-input-model.tsx
+++ b/src/components/features/chat/components/chat-input-model.tsx
@@ -10,15 +10,6 @@ import { cn } from "#/utils/utils";
import React from "react";
import { useTranslation } from "react-i18next";
-const MODEL_LABEL_MAX_CHARS = 10;
-
-function truncateModelLabel(model: string): string {
- if (model.length <= MODEL_LABEL_MAX_CHARS) {
- return model;
- }
- return `${model.slice(0, MODEL_LABEL_MAX_CHARS)}…`;
-}
-
export function ChatInputModel() {
const { t } = useTranslation("openhands");
const { data: conversation } = useActiveConversation();
@@ -31,7 +22,6 @@ export function ChatInputModel() {
if (!conversation?.llm_model) {
return null;
}
- const truncatedModelLabel = truncateModelLabel(conversation.llm_model);
return (
<div className="relative min-w-0">
@@ -51,7 +41,7 @@ export function ChatInputModel() {
setIsPopoverOpen((open) => !open);
}}
>
- <span>{truncatedModelLabel}</span>
+ <span>{conversation.llm_model}</span>
<ChevronDownSmallIcon
width={18}
height={18}
@@ -68,10 +58,10 @@ export function ChatInputModel() {
position="top"
alignment="left"
spacing="none"
- className="z-[60] mb-2 min-w-[200px] max-w-[320px]"
+ className="z-[60] mb-2 min-w-[200px]"
>
<li className="text-sm">
- <div className="p-2 leading-5 text-white break-all">
+ <div className="p-2 leading-5 text-white whitespace-nowrap">
{conversation.llm_model}
</div>
</li>
diff --git a/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/reasoning-content-collapsed.png b/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/reasoning-content-collapsed.png
index 83f2ae3c32..9da10b3abd 100644
Binary files a/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/reasoning-content-collapsed.png and b/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/reasoning-content-collapsed.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/reasoning-content-expanded.png b/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/reasoning-content-expanded.png
index bc7ddd944b..81c60f5a64 100644
Binary files a/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/reasoning-content-expanded.png and b/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/reasoning-content-expanded.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/think-action-collapsed.png b/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/think-action-collapsed.png
index f4e957a699..cea5fdc966 100644
Binary files a/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/think-action-collapsed.png and b/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/think-action-collapsed.png differ
diff --git a/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/think-action-expanded.png b/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/think-action-expanded.png
index d21e9a6102..4d7cb8c71f 100644
Binary files a/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/think-action-expanded.png and b/tests/e2e/__snapshots__/snapshots/collapsible-thinking.snapshot.spec.ts/chromium/think-action-expanded.png differ