test: configure parallels smoke provider timeout · openclaw/openclaw@0e8cb3d
steipete
·
2026-05-01
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -13,11 +13,11 @@ import {
|
13 | 13 | parseMode, |
14 | 14 | parseProvider, |
15 | 15 | providerIdFromModelId, |
| 16 | +providerTimeoutConfigJson, |
16 | 17 | repoRoot, |
17 | 18 | resolveHostIp, |
18 | 19 | resolveHostPort, |
19 | 20 | resolveLatestVersion, |
20 | | -resolveParallelsModelTimeoutSeconds, |
21 | 21 | resolveProviderAuth, |
22 | 22 | resolveSnapshot, |
23 | 23 | run, |
@@ -690,14 +690,17 @@ rm -rf /root/.openclaw/test-bad-plugin`);
|
690 | 690 | private verifyLocalTurn(): void { |
691 | 691 | this.guestExec(["openclaw", "models", "set", this.auth.modelId]); |
692 | 692 | const providerId = providerIdFromModelId(this.auth.modelId) || this.options.provider; |
693 | | -this.guestExec([ |
694 | | -"openclaw", |
695 | | -"config", |
696 | | -"set", |
697 | | -`models.providers.${providerId}.timeoutSeconds`, |
698 | | -String(resolveParallelsModelTimeoutSeconds("linux")), |
699 | | -"--strict-json", |
700 | | -]); |
| 693 | +const providerTimeoutConfig = providerTimeoutConfigJson(this.auth.modelId, "linux"); |
| 694 | +if (providerTimeoutConfig) { |
| 695 | +this.guestExec([ |
| 696 | +"openclaw", |
| 697 | +"config", |
| 698 | +"set", |
| 699 | +`models.providers.${providerId}`, |
| 700 | +providerTimeoutConfig, |
| 701 | +"--strict-json", |
| 702 | +]); |
| 703 | +} |
701 | 704 | this.guestExec([ |
702 | 705 | "openclaw", |
703 | 706 | "config", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,10 +12,10 @@ import {
|
12 | 12 | parseMode, |
13 | 13 | parseProvider, |
14 | 14 | providerIdFromModelId, |
| 15 | +providerTimeoutConfigJson, |
15 | 16 | resolveHostIp, |
16 | 17 | resolveHostPort, |
17 | 18 | resolveLatestVersion, |
18 | | -resolveParallelsModelTimeoutSeconds, |
19 | 19 | resolveProviderAuth, |
20 | 20 | resolveSnapshot, |
21 | 21 | run, |
@@ -974,15 +974,18 @@ exit 1`);
|
974 | 974 | private verifyTurn(): void { |
975 | 975 | this.guestExec([guestNode, guestOpenClawEntry, "models", "set", this.auth.modelId]); |
976 | 976 | const providerId = providerIdFromModelId(this.auth.modelId) || this.options.provider; |
977 | | -this.guestExec([ |
978 | | -guestNode, |
979 | | -guestOpenClawEntry, |
980 | | -"config", |
981 | | -"set", |
982 | | -`models.providers.${providerId}.timeoutSeconds`, |
983 | | -String(resolveParallelsModelTimeoutSeconds("macos")), |
984 | | -"--strict-json", |
985 | | -]); |
| 977 | +const providerTimeoutConfig = providerTimeoutConfigJson(this.auth.modelId, "macos"); |
| 978 | +if (providerTimeoutConfig) { |
| 979 | +this.guestExec([ |
| 980 | +guestNode, |
| 981 | +guestOpenClawEntry, |
| 982 | +"config", |
| 983 | +"set", |
| 984 | +`models.providers.${providerId}`, |
| 985 | +providerTimeoutConfig, |
| 986 | +"--strict-json", |
| 987 | +]); |
| 988 | +} |
986 | 989 | this.guestExec([ |
987 | 990 | guestNode, |
988 | 991 | guestOpenClawEntry, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,7 @@ import {
|
5 | 5 | windowsModelProviderTimeoutScript, |
6 | 6 | windowsOpenClawResolver, |
7 | 7 | } from "./powershell.ts"; |
8 | | -import { providerIdFromModelId, resolveParallelsModelTimeoutSeconds } from "./provider-auth.ts"; |
| 8 | +import { providerIdFromModelId, providerTimeoutConfigJson } from "./provider-auth.ts"; |
9 | 9 | import type { Platform, ProviderAuth } from "./types.ts"; |
10 | 10 | |
11 | 11 | export interface NpmUpdateScriptInput { |
@@ -20,12 +20,13 @@ function posixModelProviderTimeoutCommand(
|
20 | 20 | platform: Platform, |
21 | 21 | ): string { |
22 | 22 | const providerId = providerIdFromModelId(modelId); |
23 | | -if (!providerId) { |
| 23 | +const configJson = providerTimeoutConfigJson(modelId, platform); |
| 24 | +if (!providerId || !configJson) { |
24 | 25 | return ""; |
25 | 26 | } |
26 | | -return `${command} config set ${shellQuote( |
27 | | - `models.providers.${providerId}.timeoutSeconds`, |
28 | | - )} ${resolveParallelsModelTimeoutSeconds(platform)} --strict-json`; |
| 27 | +return `${command} config set ${shellQuote(`models.providers.${providerId}`)} ${shellQuote( |
| 28 | + configJson, |
| 29 | + )} --strict-json`; |
29 | 30 | } |
30 | 31 | |
31 | 32 | function posixAssertAgentOkScript(command: string, input: NpmUpdateScriptInput, sessionId: string) { |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -import { providerIdFromModelId, resolveParallelsModelTimeoutSeconds } from "./provider-auth.ts"; |
| 1 | +import { providerIdFromModelId, providerTimeoutConfigJson } from "./provider-auth.ts"; |
2 | 2 | |
3 | 3 | export function psSingleQuote(value: string): string { |
4 | 4 | return `'${value.replaceAll("'", "''")}'`; |
@@ -16,12 +16,11 @@ export function encodePowerShell(script: string): string {
|
16 | 16 | |
17 | 17 | export function windowsModelProviderTimeoutScript(modelId: string): string { |
18 | 18 | const providerId = providerIdFromModelId(modelId); |
19 | | -if (!providerId) { |
| 19 | +const configJson = providerTimeoutConfigJson(modelId, "windows"); |
| 20 | +if (!providerId || !configJson) { |
20 | 21 | return ""; |
21 | 22 | } |
22 | | -return `Invoke-OpenClaw config set ${psSingleQuote( |
23 | | - `models.providers.${providerId}.timeoutSeconds`, |
24 | | - )} ${resolveParallelsModelTimeoutSeconds("windows")} --strict-json |
| 23 | +return `Invoke-OpenClaw config set ${psSingleQuote(`models.providers.${providerId}`)} ${psSingleQuote(configJson)} --strict-json |
25 | 24 | if ($LASTEXITCODE -ne 0) { throw "model provider timeout config set failed" }`; |
26 | 25 | } |
27 | 26 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -86,6 +86,30 @@ export function resolveParallelsModelTimeoutSeconds(platform?: Platform): number
|
86 | 86 | return Number.isFinite(raw) && raw > 0 ? Math.floor(raw) : 600; |
87 | 87 | } |
88 | 88 | |
| 89 | +export function providerTimeoutConfigJson(modelId: string, platform: Platform): string { |
| 90 | +const providerId = providerIdFromModelId(modelId); |
| 91 | +if (providerId !== "openai") { |
| 92 | +return ""; |
| 93 | +} |
| 94 | +const modelName = modelId.slice("openai/".length).trim(); |
| 95 | +if (!modelName) { |
| 96 | +return ""; |
| 97 | +} |
| 98 | +return JSON.stringify({ |
| 99 | +api: "openai-responses", |
| 100 | +baseUrl: "https://api.openai.com/v1", |
| 101 | +models: [ |
| 102 | +{ |
| 103 | +contextWindow: 1_047_576, |
| 104 | +id: modelName, |
| 105 | +maxTokens: 32_768, |
| 106 | +name: modelName, |
| 107 | +}, |
| 108 | +], |
| 109 | +timeoutSeconds: resolveParallelsModelTimeoutSeconds(platform), |
| 110 | +}); |
| 111 | +} |
| 112 | + |
89 | 113 | export function parseProvider(value: string): Provider { |
90 | 114 | if (value === "openai" || value === "anthropic" || value === "minimax") { |
91 | 115 | return value; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -321,8 +321,8 @@ console.log(JSON.stringify(result));
|
321 | 321 | expect(script, scriptPath).toContain("minimal"); |
322 | 322 | expect(script, scriptPath).toContain("finalAssistant(Raw|Visible)Text"); |
323 | 323 | } |
324 | | -expect(readFileSync(TS_PATHS.macos, "utf8")).toContain("resolveParallelsModelTimeoutSeconds"); |
325 | | -expect(readFileSync(TS_PATHS.linux, "utf8")).toContain("resolveParallelsModelTimeoutSeconds"); |
| 324 | +expect(readFileSync(TS_PATHS.macos, "utf8")).toContain("providerTimeoutConfigJson"); |
| 325 | +expect(readFileSync(TS_PATHS.linux, "utf8")).toContain("providerTimeoutConfigJson"); |
326 | 326 | expect(readFileSync(TS_PATHS.windows, "utf8")).toContain("windowsModelProviderTimeoutScript"); |
327 | 327 | |
328 | 328 | const npmUpdateScripts = readFileSync(TS_PATHS.npmUpdateScripts, "utf8"); |
@@ -479,8 +479,8 @@ console.log(JSON.stringify(result));
|
479 | 479 | const windows = readFileSync(TS_PATHS.windows, "utf8"); |
480 | 480 | |
481 | 481 | expect(powershell).toContain("windowsOpenClawResolver"); |
482 | | -expect(powershell).toContain('resolveParallelsModelTimeoutSeconds("windows")'); |
483 | | -expect(powershell).toContain("models.providers.${providerId}.timeoutSeconds"); |
| 482 | +expect(powershell).toContain("providerTimeoutConfigJson"); |
| 483 | +expect(powershell).toContain("models.providers.${providerId}"); |
484 | 484 | expect(powershell).toContain("Resolve-OpenClawCommand"); |
485 | 485 | expect(powershell).toContain("npm\\node_modules\\openclaw\\openclaw.mjs"); |
486 | 486 | expect(powershell).toContain("$ErrorActionPreference = 'Continue'"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。