From 84a3b50c11125b37beace69edc45f4658001ec9b Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 1 May 2026 17:10:36 +0100 Subject: [PATCH] test(parallels): force POSIX OpenAI SSE smoke --- scripts/e2e/parallels/linux-smoke.ts | 9 ++++++ scripts/e2e/parallels/macos-smoke.ts | 9 ++++++ scripts/e2e/parallels/npm-update-scripts.ts | 33 +++++++++++++++------ scripts/e2e/parallels/provider-auth.ts | 12 ++++++++ test/scripts/parallels-smoke-model.test.ts | 4 +++ 5 files changed, 58 insertions(+), 9 deletions(-) diff --git a/scripts/e2e/parallels/linux-smoke.ts b/scripts/e2e/parallels/linux-smoke.ts index cb13ec2cf6b..8ca8c7ed72f 100755 --- a/scripts/e2e/parallels/linux-smoke.ts +++ b/scripts/e2e/parallels/linux-smoke.ts @@ -12,6 +12,7 @@ import { parseBoolEnv, parseMode, parseProvider, + modelTransportConfigJson, providerIdFromModelId, providerTimeoutConfigJson, repoRoot, @@ -698,6 +699,14 @@ rm -rf /root/.openclaw/test-bad-plugin`); )} --strict-json`, ); } + const modelTransportConfig = modelTransportConfigJson(this.auth.modelId); + if (modelTransportConfig) { + this.guestBash( + `openclaw config set ${shellQuote( + `agents.defaults.models.${this.auth.modelId}`, + )} ${shellQuote(modelTransportConfig)} --strict-json`, + ); + } this.guestExec([ "openclaw", "config", diff --git a/scripts/e2e/parallels/macos-smoke.ts b/scripts/e2e/parallels/macos-smoke.ts index 7d8a53273b7..2705d149d0a 100755 --- a/scripts/e2e/parallels/macos-smoke.ts +++ b/scripts/e2e/parallels/macos-smoke.ts @@ -11,6 +11,7 @@ import { packOpenClaw, parseMode, parseProvider, + modelTransportConfigJson, providerIdFromModelId, providerTimeoutConfigJson, resolveHostIp, @@ -982,6 +983,14 @@ exit 1`); )} ${shellQuote(providerTimeoutConfig)} --strict-json`, ); } + const modelTransportConfig = modelTransportConfigJson(this.auth.modelId); + if (modelTransportConfig) { + this.guestSh( + `${shellQuote(guestNode)} ${shellQuote(guestOpenClawEntry)} config set ${shellQuote( + `agents.defaults.models.${this.auth.modelId}`, + )} ${shellQuote(modelTransportConfig)} --strict-json`, + ); + } this.guestExec([ guestNode, guestOpenClawEntry, diff --git a/scripts/e2e/parallels/npm-update-scripts.ts b/scripts/e2e/parallels/npm-update-scripts.ts index 6689cd2d2c4..9f31ca41add 100644 --- a/scripts/e2e/parallels/npm-update-scripts.ts +++ b/scripts/e2e/parallels/npm-update-scripts.ts @@ -5,7 +5,11 @@ import { windowsModelProviderTimeoutScript, windowsOpenClawResolver, } from "./powershell.ts"; -import { providerIdFromModelId, providerTimeoutConfigJson } from "./provider-auth.ts"; +import { + modelTransportConfigJson, + providerIdFromModelId, + providerTimeoutConfigJson, +} from "./provider-auth.ts"; import type { Platform, ProviderAuth } from "./types.ts"; export interface NpmUpdateScriptInput { @@ -14,19 +18,30 @@ export interface NpmUpdateScriptInput { updateTarget: string; } -function posixModelProviderTimeoutCommand( +function posixModelProviderConfigCommands( command: string, modelId: string, platform: Platform, ): string { + const commands: string[] = []; const providerId = providerIdFromModelId(modelId); const configJson = providerTimeoutConfigJson(modelId, platform); - if (!providerId || !configJson) { - return ""; + if (providerId && configJson) { + commands.push( + `${command} config set ${shellQuote(`models.providers.${providerId}`)} ${shellQuote( + configJson, + )} --strict-json`, + ); } - return `${command} config set ${shellQuote(`models.providers.${providerId}`)} ${shellQuote( - configJson, - )} --strict-json`; + const transportJson = modelTransportConfigJson(modelId); + if (transportJson) { + commands.push( + `${command} config set ${shellQuote(`agents.defaults.models.${modelId}`)} ${shellQuote( + transportJson, + )} --strict-json`, + ); + } + return commands.join("\n"); } function posixAssertAgentOkScript(command: string, input: NpmUpdateScriptInput, sessionId: string) { @@ -123,7 +138,7 @@ ${posixVersionCheck("/opt/homebrew/bin/openclaw", input.expectedNeedle)} start_openclaw_gateway wait_for_gateway /opt/homebrew/bin/openclaw models set ${shellQuote(input.auth.modelId)} -${posixModelProviderTimeoutCommand("/opt/homebrew/bin/openclaw", input.auth.modelId, "macos")} +${posixModelProviderConfigCommands("/opt/homebrew/bin/openclaw", input.auth.modelId, "macos")} /opt/homebrew/bin/openclaw config set agents.defaults.skipBootstrap true --strict-json /opt/homebrew/bin/openclaw config set tools.profile minimal ${posixAgentWorkspaceScript("Parallels npm update smoke test assistant.")} @@ -280,7 +295,7 @@ ${posixVersionCheck("openclaw", input.expectedNeedle)} start_openclaw_gateway wait_for_gateway openclaw models set ${shellQuote(input.auth.modelId)} -${posixModelProviderTimeoutCommand("openclaw", input.auth.modelId, "linux")} +${posixModelProviderConfigCommands("openclaw", input.auth.modelId, "linux")} openclaw config set agents.defaults.skipBootstrap true --strict-json openclaw config set tools.profile minimal ${posixAgentWorkspaceScript("Parallels npm update smoke test assistant.")} diff --git a/scripts/e2e/parallels/provider-auth.ts b/scripts/e2e/parallels/provider-auth.ts index de8509aa184..dcdbd4805b8 100644 --- a/scripts/e2e/parallels/provider-auth.ts +++ b/scripts/e2e/parallels/provider-auth.ts @@ -110,6 +110,18 @@ export function providerTimeoutConfigJson(modelId: string, platform: Platform): }); } +export function modelTransportConfigJson(modelId: string): string { + if (providerIdFromModelId(modelId) !== "openai") { + return ""; + } + return JSON.stringify({ + alias: "GPT", + params: { + transport: "sse", + }, + }); +} + export function parseProvider(value: string): Provider { if (value === "openai" || value === "anthropic" || value === "minimax") { return value; diff --git a/test/scripts/parallels-smoke-model.test.ts b/test/scripts/parallels-smoke-model.test.ts index d0dd069db21..e5f566b0313 100644 --- a/test/scripts/parallels-smoke-model.test.ts +++ b/test/scripts/parallels-smoke-model.test.ts @@ -322,7 +322,9 @@ console.log(JSON.stringify(result)); expect(script, scriptPath).toContain("finalAssistant(Raw|Visible)Text"); } expect(readFileSync(TS_PATHS.macos, "utf8")).toContain("providerTimeoutConfigJson"); + expect(readFileSync(TS_PATHS.macos, "utf8")).toContain("modelTransportConfigJson"); expect(readFileSync(TS_PATHS.linux, "utf8")).toContain("providerTimeoutConfigJson"); + expect(readFileSync(TS_PATHS.linux, "utf8")).toContain("modelTransportConfigJson"); expect(readFileSync(TS_PATHS.windows, "utf8")).toContain("windowsModelProviderTimeoutScript"); expect(readFileSync(TS_PATHS.powershell, "utf8")).toContain("config set --batch-file"); @@ -334,6 +336,8 @@ console.log(JSON.stringify(result)); expect(npmUpdateScripts).toContain("finalAssistant(Raw|Visible)Text"); expect(npmUpdateScripts).toContain("posixAssertAgentOkScript"); expect(npmUpdateScripts).toContain("windowsModelProviderTimeoutScript"); + expect(npmUpdateScripts).toContain("modelTransportConfigJson"); + expect(npmUpdateScripts).toContain("agents.defaults.models.${modelId}"); }); it("clears phase timers and applies phase deadlines to guest commands", () => {