From 2eb07e68a16890330b5705acc1334a259441c6bd Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 10 May 2026 06:40:33 +0100 Subject: [PATCH] fix(models): canonicalize auth default models --- CHANGELOG.md | 1 + .../auth-choice.apply.plugin-provider.test.ts | 23 +++++++++++++++++++ src/plugins/provider-auth-choice.ts | 7 +++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4fe43da34ef..893937c8f5b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -108,6 +108,7 @@ Docs: https://docs.openclaw.ai - Google/Gemini: normalize nested proxy-provider catalog ids like `google/gemini-3-pro-preview` to `google/gemini-3.1-pro-preview`, so Kilo-style configured catalogs test Gemini 3.1 instead of the retired Gemini 3 Pro id. - Google/Gemini: canonicalize provider-onboarding model alias maps so setup flows preserve settings under `google/gemini-3.1-pro-preview` instead of re-emitting retired Gemini 3 Pro config keys. - Google/Gemini: canonicalize retired Gemini 3 Pro Preview ids inside Google dynamic model resolution so runtime clones also use `google/gemini-3.1-pro-preview`. +- Google/Gemini: canonicalize provider-auth default model results before setup hooks and picker returns so auth flows do not re-emit retired `google/gemini-3-pro-preview` selections. - Amazon Bedrock: support `serviceTier` parameter for Bedrock models, configurable via `agents.defaults.params.serviceTier` or per-model in `agents.defaults.models`. Valid values: `default`, `flex`, `priority`, `reserved`. (#64512) Thanks @mobilinkd. - Control UI: read the Quick Settings exec policy badge from `tools.exec.security` instead of the non-schema `agents.defaults.exec.security` path, so configured `full`/`deny` values render accurately. Fixes #78311. Thanks @FriedBack. - Control UI/usage: add transcript-backed historical lineage rollups for rotated logical sessions, with current-instance vs historical-lineage scope controls and long-range presets so usage history stays visible after restarts and updates. Fixes #50701. Thanks @dev-gideon-llc and @BunsDev. diff --git a/src/commands/auth-choice.apply.plugin-provider.test.ts b/src/commands/auth-choice.apply.plugin-provider.test.ts index 789710848c00..a772b6e10f39 100644 --- a/src/commands/auth-choice.apply.plugin-provider.test.ts +++ b/src/commands/auth-choice.apply.plugin-provider.test.ts @@ -586,6 +586,29 @@ describe("applyAuthChoiceLoadedPluginProvider", () => { ); }); + it("normalizes retired Google Gemini default models returned by auth methods", async () => { + const method: ProviderAuthMethod = { + id: "google", + label: "Google", + kind: "custom", + run: async () => ({ + profiles: [], + defaultModel: "google/gemini-3-pro-preview", + }), + }; + + const result = await runProviderPluginAuthMethod({ + config: {}, + runtime: {} as ApplyAuthChoiceParams["runtime"], + prompter: { + note: vi.fn(async () => {}), + } as unknown as ApplyAuthChoiceParams["prompter"], + method, + }); + + expect(result.defaultModel).toBe("google/gemini-3.1-pro-preview"); + }); + it("replaces provider-owned default model maps during auth migrations", async () => { const method: ProviderAuthMethod = { id: "local", diff --git a/src/plugins/provider-auth-choice.ts b/src/plugins/provider-auth-choice.ts index eb744865247f..b2052344d1a7 100644 --- a/src/plugins/provider-auth-choice.ts +++ b/src/plugins/provider-auth-choice.ts @@ -6,6 +6,7 @@ import { import { upsertAuthProfile } from "../agents/auth-profiles.js"; import { formatLiteralProviderPrefixedModelRef } from "../agents/model-ref-shared.js"; import { resolveDefaultAgentWorkspaceDir } from "../agents/workspace.js"; +import { normalizeAgentModelRefForConfig } from "../config/model-input.js"; import type { OpenClawConfig } from "../config/types.openclaw.js"; import type { RuntimeEnv } from "../runtime.js"; import { sanitizeTerminalText } from "../terminal/safe-text.js"; @@ -289,9 +290,13 @@ export async function runProviderPluginAuthMethod(params: { await params.prompter.note(result.notes.join("\n"), "Provider notes"); } + const defaultModel = result.defaultModel + ? normalizeAgentModelRefForConfig(result.defaultModel) + : undefined; + return { config: nextConfig, - defaultModel: result.defaultModel, + ...(defaultModel ? { defaultModel } : {}), }; }