From ff2dc79fe790ccc69a131183b3cada2f0b6a3b14 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 9 May 2026 03:19:57 +0100 Subject: [PATCH] fix: canonicalize gemini onboarding model keys --- CHANGELOG.md | 1 + .../onboard-auth.config-shared.test.ts | 49 +++++++++++++++++++ src/plugin-sdk/provider-onboard.ts | 18 ++++--- 3 files changed, 61 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e35973bc054..4c04cba9f39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Docs: https://docs.openclaw.ai - Google/Gemini: normalize retired `google/gemini-3-pro-preview` and `google-gemini-cli/gemini-3-pro-preview` selections to `google/gemini-3.1-pro-preview` before they are written to model config. - Google/Gemini: emit canonical `google/gemini-3.1-pro-preview` ids from configured provider catalog rows so model list and selection paths can test Gemini 3.1 instead of retired Gemini 3 Pro. - 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. - 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/onboard-auth.config-shared.test.ts b/src/commands/onboard-auth.config-shared.test.ts index dba920f1e41..00583f47638 100644 --- a/src/commands/onboard-auth.config-shared.test.ts +++ b/src/commands/onboard-auth.config-shared.test.ts @@ -94,6 +94,42 @@ describe("onboard auth provider config merges", () => { }); }); + it("normalizes retired Google agent model keys when adding provider models", () => { + const cfg: OpenClawConfig = { + agents: { + defaults: { + models: { + "google/gemini-3-pro-preview": { + alias: "Gemini", + params: { thinkingLevel: "high" }, + }, + }, + }, + }, + }; + + const next = applyProviderConfigWithDefaultModels(cfg, { + agentModels: { + "google/gemini-3.1-pro-preview": { + params: { serviceTier: "standard" }, + }, + }, + providerId: "custom", + api: "openai-completions", + baseUrl: "https://new.example.com/v1", + defaultModels: [makeModel("model-b")], + defaultModelId: "model-b", + }); + + expect(next.agents?.defaults?.models).toEqual({ + "google/gemini-3.1-pro-preview": { + alias: "Gemini", + params: { thinkingLevel: "high", serviceTier: "standard" }, + }, + }); + expect(next.agents?.defaults?.models).not.toHaveProperty("google/gemini-3-pro-preview"); + }); + it("merges model catalogs without duplicating existing model ids", () => { const cfg: OpenClawConfig = { models: { @@ -150,6 +186,19 @@ describe("onboard auth provider config merges", () => { }); }); + it("normalizes retired Google alias presets before emitting config", () => { + expect( + withAgentModelAliases( + { + "google/gemini-3-pro-preview": { alias: "Pinned" }, + }, + [{ modelRef: "google/gemini-3-pro-preview", alias: "Preset" }], + ), + ).toEqual({ + "google/gemini-3.1-pro-preview": { alias: "Pinned" }, + }); + }); + it("applies default-model presets with alias and primary model", () => { const next = applyProviderConfigWithDefaultModelPreset( { diff --git a/src/plugin-sdk/provider-onboard.ts b/src/plugin-sdk/provider-onboard.ts index f9c82ae515b..f79d1dff097 100644 --- a/src/plugin-sdk/provider-onboard.ts +++ b/src/plugin-sdk/provider-onboard.ts @@ -3,7 +3,10 @@ import { ensureStaticModelAllowlistEntry } from "../agents/model-allowlist-entry.js"; import { findNormalizedProviderKey } from "../agents/provider-id.js"; -import { normalizeAgentModelRefForConfig } from "../config/model-input.js"; +import { + normalizeAgentModelMapForConfig, + normalizeAgentModelRefForConfig, +} from "../config/model-input.js"; import type { AgentModelEntryConfig } from "../config/types.agent-defaults.js"; import type { ModelApi, @@ -165,12 +168,13 @@ export function withAgentModelAliases( existing: Record | undefined, aliases: readonly AgentModelAliasEntry[], ): Record { - const next = { ...existing }; + const next = normalizeAgentModelMapForConfig({ ...existing }); for (const entry of aliases) { const normalized = normalizeAgentModelAliasEntry(entry); - next[normalized.modelRef] = { - ...next[normalized.modelRef], - ...(normalized.alias ? { alias: next[normalized.modelRef]?.alias ?? normalized.alias } : {}), + const modelRef = normalizeAgentModelRefForConfig(normalized.modelRef); + next[modelRef] = { + ...next[modelRef], + ...(normalized.alias ? { alias: next[modelRef]?.alias ?? normalized.alias } : {}), }; } return next; @@ -183,10 +187,10 @@ export function applyOnboardAuthAgentModelsAndProviders( providers: Record; }, ): OpenClawConfig { - const mergedAgentModels = { + const mergedAgentModels = normalizeAgentModelMapForConfig({ ...cfg.agents?.defaults?.models, ...params.agentModels, - }; + }); return { ...cfg, agents: {