Skip to content

Commit fb453e7

Browse files
mmyzwlclaude
andcommitted
fix(ui): show effective runtime model in dropdown after fallback/drift
When the runtime silently falls back to the default model, the chat model dropdown showed the stale user-selected model instead of the effective model. The cached override always won, even when the session's actual model had changed. Fix: compare the cached override with the session's effective server model. When they differ (fallback/default drift), show the effective model so the dropdown reflects reality. Closes #93346 Co-Authored-By: Claude <[email protected]>
1 parent 794bd89 commit fb453e7

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

ui/src/ui/chat-model-select-state.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,24 @@ function resolveActiveSessionRow(state: ChatModelSelectStateInput) {
3434

3535
export function resolveChatModelOverrideValue(state: ChatModelSelectStateInput): string {
3636
const catalog = state.chatModelCatalog ?? [];
37-
38-
// Prefer the local cache — it reflects in-flight patches before sessionsResult refreshes.
3937
const cached = state.chatModelOverrides[state.sessionKey];
38+
39+
// When a local override is cached, also resolve the effective server model
40+
// so the dropdown reflects the actual runtime model after fallback/default drift.
4041
if (cached) {
41-
return normalizeChatModelOverrideValue(cached, catalog);
42+
const cachedValue = normalizeChatModelOverrideValue(cached, catalog);
43+
const activeRow = resolveActiveSessionRow(state);
44+
const serverValue = resolvePreferredServerChatModelValue(
45+
activeRow?.model,
46+
activeRow?.modelProvider,
47+
catalog,
48+
);
49+
// If the effective session model differs from the cached override, the
50+
// runtime has fallen back or drifted — show the effective model instead.
51+
if (serverValue && cachedValue !== serverValue) {
52+
return serverValue;
53+
}
54+
return cachedValue;
4255
}
4356
if (cached === null) {
4457
return "";

0 commit comments

Comments
 (0)