From da2d7beac8cbcf3bd2f0cbec03c876c1f88a4b46 Mon Sep 17 00:00:00 2001 From: Artur Do Lago Date: Sat, 10 Jan 2026 00:02:23 +0100 Subject: [PATCH] fix(tui): don't fallback to first provider when agents loading When using the placeholder agent (before real agents load), return undefined instead of falling back to the first provider's model. This prevents showing google-vertex-anthropic models before the agent's configured model loads. Co-Authored-By: Claude Opus 4.5 --- packages/agent-core/src/cli/cmd/tui/context/local.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/agent-core/src/cli/cmd/tui/context/local.tsx b/packages/agent-core/src/cli/cmd/tui/context/local.tsx index b09a30cdc5..f58a9a563b 100644 --- a/packages/agent-core/src/cli/cmd/tui/context/local.tsx +++ b/packages/agent-core/src/cli/cmd/tui/context/local.tsx @@ -205,15 +205,19 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({ const currentModel = createMemo(() => { const a = agent.current() + // If using placeholder agent (no name), don't return any model yet + if (!a?.name) { + return undefined + } // Agent's configured model takes priority - trust it without validation // Custom models (like cerebras/zai-glm-4.7) may not be in the provider list - if (a?.model) { + if (a.model) { return a.model } // For non-configured agents, use cached selection or fallback (with validation) return ( getFirstValidModel( - () => modelStore.model[a?.name ?? ""], // Cached selection + () => modelStore.model[a.name], // Cached selection fallbackModel, // Global fallback ) ?? undefined )