From 754f457a9483b0185066c9e6b3f93df4fcd54e96 Mon Sep 17 00:00:00 2001 From: Xubin Ren <52506698+Re-bin@users.noreply.github.com> Date: Thu, 23 Jul 2026 22:50:54 +0800 Subject: [PATCH] fix(webui): keep composer model badge in sync --- webui/src/components/thread/ThreadShell.tsx | 2 +- webui/src/tests/thread-shell.test.tsx | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/webui/src/components/thread/ThreadShell.tsx b/webui/src/components/thread/ThreadShell.tsx index a364f10d..2094929d 100644 --- a/webui/src/components/thread/ThreadShell.tsx +++ b/webui/src/components/thread/ThreadShell.tsx @@ -195,7 +195,7 @@ function toModelBadgeInfo( const preset = modelPresetForBadge(settings, scopedPreset); const model = scopedPreset ? preset?.model || null - : modelName || settings?.agent.model || null; + : settings?.agent.model || modelName || null; const label = toModelBadgeLabel(model); const rawProvider = preset?.provider || (!scopedPreset ? settings?.agent.provider : null) diff --git a/webui/src/tests/thread-shell.test.tsx b/webui/src/tests/thread-shell.test.tsx index b7f910aa..b0d61cc6 100644 --- a/webui/src/tests/thread-shell.test.tsx +++ b/webui/src/tests/thread-shell.test.tsx @@ -369,6 +369,26 @@ describe("ThreadShell", () => { expect(await screen.findByTestId("composer-model-logo-openai_codex")).toBeInTheDocument(); }); + it("keeps the composer model name and provider on the same settings snapshot", async () => { + const client = makeClient(); + render( + wrap( + client, + {}} + settingsSnapshot={modelSettings("openai-codex/gpt-5.5", "openai_codex")} + />, + "ling/ling-3.0-flash", + ), + ); + + expect(await screen.findByTestId("composer-model-logo-openai_codex")).toBeInTheDocument(); + expect(screen.getByText("gpt-5.5")).toBeInTheDocument(); + expect(screen.queryByText("ling-3.0-flash")).not.toBeInTheDocument(); + }); + it("resolves the composer model from the active session preset", async () => { const client = makeClient(); render(