Skip to content

Commit c59163c

Browse files
fix #84745: preserve proxy Google model normalization
Restore nested google/ suffix normalization for proxy providers while keeping bare non-Google Gemini-looking refs unchanged, with regression coverage for LiteLLM allowlist entries. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent efffcd1 commit c59163c

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

src/commands/model-picker.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,17 @@ describe("applyModelAllowlist", () => {
14451445
expect(next.agents?.defaults?.models).toEqual({
14461446
"google/gemini-3.1-pro-preview": { alias: "gemini" },
14471447
"google-gemini-cli/gemini-3.1-pro-preview": {},
1448-
"openrouter/google/gemini-3-pro-preview": {},
1448+
"openrouter/google/gemini-3.1-pro-preview": {},
1449+
});
1450+
});
1451+
1452+
it("keeps non-Google provider Gemini-looking refs unchanged while writing selected models", () => {
1453+
const config = {} as OpenClawConfig;
1454+
1455+
const next = applyModelAllowlist(config, ["litellm/gemini-3-flash", "litellm/gemini-3.1-pro"]);
1456+
expect(next.agents?.defaults?.models).toEqual({
1457+
"litellm/gemini-3-flash": {},
1458+
"litellm/gemini-3.1-pro": {},
14491459
});
14501460
});
14511461

@@ -1572,7 +1582,7 @@ describe("applyModelFallbacksFromSelection", () => {
15721582
]);
15731583
expect(next.agents?.defaults?.model).toEqual({
15741584
primary: "openai/gpt-5.5",
1575-
fallbacks: ["google/gemini-3.1-pro-preview", "openrouter/google/gemini-3-pro-preview"],
1585+
fallbacks: ["google/gemini-3.1-pro-preview", "openrouter/google/gemini-3.1-pro-preview"],
15761586
});
15771587
});
15781588

src/config/model-input.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ export function normalizeAgentModelRefForConfig(model: string): string {
7878

7979
const provider = normalizeProviderId(trimmed.slice(0, slash));
8080
const modelSuffix = trimmed.slice(slash + 1);
81-
const normalizedModel = GOOGLE_PROVIDER_IDS.has(provider)
82-
? normalizeGooglePreviewModelId(modelSuffix)
83-
: modelSuffix;
81+
const normalizedModel =
82+
GOOGLE_PROVIDER_IDS.has(provider) || modelSuffix.startsWith("google/")
83+
? normalizeGooglePreviewModelId(modelSuffix)
84+
: modelSuffix;
8485
return modelKeyForConfig(provider, normalizedModel);
8586
}
8687

0 commit comments

Comments
 (0)