From b9efba1fafd4d7108480f43309eb78619df02adf Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 23 Mar 2026 10:58:31 +0000 Subject: [PATCH] test: target gemini 3.1 flash alias --- .../gateway-models.profiles.live.test.ts | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/gateway/gateway-models.profiles.live.test.ts b/src/gateway/gateway-models.profiles.live.test.ts index 059914a01d4..a76ff5ec31f 100644 --- a/src/gateway/gateway-models.profiles.live.test.ts +++ b/src/gateway/gateway-models.profiles.live.test.ts @@ -21,6 +21,7 @@ import { isModelNotFoundErrorMessage } from "../agents/live-model-errors.js"; import { isModernModelRef } from "../agents/live-model-filter.js"; import { isLiveTestEnabled } from "../agents/live-test-helpers.js"; import { getApiKeyForModel } from "../agents/model-auth.js"; +import { normalizeGoogleModelId } from "../agents/model-id-normalization.js"; import { shouldSuppressBuiltInModel } from "../agents/model-suppression.js"; import { ensureOpenClawModelsJson } from "../agents/models-config.js"; import { isRateLimitErrorMessage } from "../agents/pi-embedded-helpers/errors.js"; @@ -60,7 +61,10 @@ const GATEWAY_LIVE_HEARTBEAT_MS = Math.max( 1_000, toInt(process.env.OPENCLAW_LIVE_GATEWAY_HEARTBEAT_MS, 30_000), ); -const GATEWAY_LIVE_STRIP_SCAFFOLDING_MODEL_KEYS = new Set(["google/gemini-3-flash-preview"]); +const GATEWAY_LIVE_STRIP_SCAFFOLDING_MODEL_KEYS = new Set([ + "google/gemini-3-flash-preview", + "google/gemini-3-pro-preview", +]); const GATEWAY_LIVE_MAX_MODELS = resolveGatewayLiveMaxModels(); const GATEWAY_LIVE_SUITE_TIMEOUT_MS = resolveGatewayLiveSuiteTimeoutMs(GATEWAY_LIVE_MAX_MODELS); @@ -271,7 +275,18 @@ function isMeaningful(text: string): boolean { } function shouldStripAssistantScaffoldingForLiveModel(modelKey?: string): boolean { - return !!modelKey && GATEWAY_LIVE_STRIP_SCAFFOLDING_MODEL_KEYS.has(modelKey); + if (!modelKey) { + return false; + } + if (GATEWAY_LIVE_STRIP_SCAFFOLDING_MODEL_KEYS.has(modelKey)) { + return true; + } + const [provider, ...rest] = modelKey.split("/"); + if (provider !== "google" || rest.length === 0) { + return false; + } + const normalizedKey = `${provider}/${normalizeGoogleModelId(rest.join("/"))}`; + return GATEWAY_LIVE_STRIP_SCAFFOLDING_MODEL_KEYS.has(normalizedKey); } function maybeStripAssistantScaffoldingForLiveModel(text: string, modelKey?: string): string { @@ -282,11 +297,11 @@ function maybeStripAssistantScaffoldingForLiveModel(text: string, modelKey?: str } describe("maybeStripAssistantScaffoldingForLiveModel", () => { - it("strips scaffolding only for the targeted live model", () => { + it("strips scaffolding for the gemini 3.1 flash alias and targeted live models", () => { expect( maybeStripAssistantScaffoldingForLiveModel( "hiddenVisible", - "google/gemini-3-flash-preview", + "google/gemini-3.1-flash-preview", ), ).toBe("Visible"); expect( @@ -294,6 +309,12 @@ describe("maybeStripAssistantScaffoldingForLiveModel", () => { "hiddenVisible", "google/gemini-3-pro-preview", ), + ).toBe("Visible"); + expect( + maybeStripAssistantScaffoldingForLiveModel( + "hiddenVisible", + "google/gemini-2.5-flash", + ), ).toBe("hiddenVisible"); }); });