fix: normalize nested gemini preview config ids

This commit is contained in:
Peter Steinberger
2026-05-13 01:05:25 +01:00
parent f8953d94bd
commit 9147a53274
4 changed files with 37 additions and 2 deletions

View File

@@ -49,6 +49,7 @@ Docs: https://docs.openclaw.ai
- Google/Gemini: normalize retired Gemini 3 Pro Preview ids returned by direct `openclaw models auth login --set-default` provider auth flows before writing config, so Gemini testing targets `google/gemini-3.1-pro-preview`.
- Google/Gemini: normalize retired Gemini 3 Pro Preview ids in provider catalog rows when API-key onboarding only reapplies the agent default, so emitted config keeps testing `google/gemini-3.1-pro-preview`.
- Google/Gemini: canonicalize provider-qualified retired Gemini 3 Pro Preview refs during Google forward-compatible model resolution, so emitted config uses `google/gemini-3.1-pro-preview` for Gemini 3.1 testing.
- Google/Gemini: normalize proxy-prefixed retired Gemini 3 Pro Preview catalog rows, so emitted configs use `google/gemini-3.1-pro-preview` for Gemini 3.1 testing.
- Docs/subagents: document `agents.defaults.subagents.announceTimeoutMs` in the sub-agent and configuration references. (#75509) Thanks @akrimm702.
- Cron: add direct `cron.get`, `openclaw cron get <id>`, and agent-tool `get` support for inspecting one stored cron job by id. (#75117) Thanks @samzong.
- Agents/tools: add per-sender tool policies with canonical channel-scoped sender keys, so operators can restrict dangerous tools by requester identity across global, agent, group, core, bundled, and plugin tool surfaces. (#66933) Thanks @JerranC.

View File

@@ -1,5 +1,8 @@
import { describe, expect, it } from "vitest";
import { normalizeStaticProviderModelId } from "./model-ref-shared.js";
import {
normalizeConfiguredProviderCatalogModelId,
normalizeStaticProviderModelId,
} from "./model-ref-shared.js";
describe("normalizeStaticProviderModelId", () => {
it("re-adds the nvidia prefix for bare model ids", () => {
@@ -14,3 +17,11 @@ describe("normalizeStaticProviderModelId", () => {
);
});
});
describe("normalizeConfiguredProviderCatalogModelId", () => {
it("normalizes nested retired Google Gemini ids in proxy-prefixed rows", () => {
expect(
normalizeConfiguredProviderCatalogModelId("kilocode", "kilocode/google/gemini-3-pro-preview"),
).toBe("kilocode/google/gemini-3.1-pro-preview");
});
});

View File

@@ -60,7 +60,17 @@ export function normalizeConfiguredProviderCatalogModelId(provider: string, mode
const providerModel = normalizeStaticProviderModelId(provider, model);
const googlePrefix = "google/";
if (!providerModel.startsWith(googlePrefix)) {
return providerModel;
const slash = providerModel.indexOf("/");
if (slash <= 0 || slash >= providerModel.length - 1) {
return providerModel;
}
const prefix = providerModel.slice(0, slash + 1);
const suffix = providerModel.slice(slash + 1);
if (!suffix.startsWith(googlePrefix)) {
return providerModel;
}
const normalizedSuffix = normalizeGooglePreviewModelId(suffix);
return normalizedSuffix === suffix ? providerModel : `${prefix}${normalizedSuffix}`;
}
const modelId = providerModel.slice(googlePrefix.length);
const normalizedModelId = normalizeGooglePreviewModelId(modelId);

View File

@@ -235,6 +235,19 @@ describe("applyModelDefaults", () => {
expect(next.models?.providers?.myproxy?.models?.[0]?.id).toBe("google/gemini-3.1-pro-preview");
});
it("normalizes provider-prefixed nested retired Gemini ids in proxy provider rows", () => {
const cfg = buildProxyProviderConfig();
const model = cfg.models.providers.myproxy.models[0];
model.id = "myproxy/google/gemini-3-pro-preview";
model.name = "Gemini via proxy";
const next = applyModelDefaults(cfg);
expect(next.models?.providers?.myproxy?.models?.[0]?.id).toBe(
"myproxy/google/gemini-3.1-pro-preview",
);
});
it("fills missing model provider defaults", () => {
const cfg = buildProxyProviderConfig();