test(parallels): force POSIX OpenAI SSE smoke

This commit is contained in:
Peter Steinberger
2026-05-01 17:10:36 +01:00
parent 3f002b10d2
commit 84a3b50c11
5 changed files with 58 additions and 9 deletions

View File

@@ -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",

View File

@@ -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,

View File

@@ -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.")}

View File

@@ -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;

View File

@@ -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", () => {