test(release): accept gateway schema rejection wrapper · openclaw/openclaw@722af38
steipete
·
2026-06-02
·
via Recent Commits to openclaw:main
File tree
scripts/e2e/lib/openai-web-search-minimal
| Original file line number | Diff line number | Diff line change |
|---|
@@ -16,6 +16,7 @@ async function loadCallGateway() {
|
16 | 16 | |
17 | 17 | const DEFAULT_RAW_SCHEMA_ERROR = |
18 | 18 | "400 The following tools cannot be used with reasoning.effort 'minimal': web_search."; |
| 19 | +const DEFAULT_GATEWAY_SCHEMA_ERROR = "provider rejected the request schema or tool payload"; |
19 | 20 | |
20 | 21 | function readExpectedRawSchemaError() { |
21 | 22 | return process.env.RAW_SCHEMA_ERROR?.trim() || DEFAULT_RAW_SCHEMA_ERROR; |
@@ -60,11 +61,14 @@ function validateRejectResult(result, expectedRawSchemaError = readExpectedRawSc
|
60 | 61 | throw new Error(`reject mode unexpectedly completed: ${JSON.stringify(result.value)}`); |
61 | 62 | } |
62 | 63 | const errorText = stringifyError(result.error); |
63 | | -if (!errorText.includes(expectedRawSchemaError)) { |
| 64 | +if ( |
| 65 | +!errorText.includes(expectedRawSchemaError) && |
| 66 | +!errorText.includes(DEFAULT_GATEWAY_SCHEMA_ERROR) |
| 67 | +) { |
64 | 68 | throw new Error( |
65 | 69 | `reject mode failed for an unexpected reason; expected ${JSON.stringify( |
66 | 70 | expectedRawSchemaError, |
67 | | - )} in ${JSON.stringify(errorText)}`, |
| 71 | + )} or ${JSON.stringify(DEFAULT_GATEWAY_SCHEMA_ERROR)} in ${JSON.stringify(errorText)}`, |
68 | 72 | ); |
69 | 73 | } |
70 | 74 | return errorText; |
@@ -122,6 +126,7 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
122 | 126 | } |
123 | 127 | |
124 | 128 | export const testing = { |
| 129 | +DEFAULT_GATEWAY_SCHEMA_ERROR, |
125 | 130 | DEFAULT_RAW_SCHEMA_ERROR, |
126 | 131 | validateRejectResult, |
127 | 132 | }; |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -11,6 +11,17 @@ describe("scripts/e2e/lib/openai-web-search-minimal/client.mjs", () => {
|
11 | 11 | ).toContain(testing.DEFAULT_RAW_SCHEMA_ERROR); |
12 | 12 | }); |
13 | 13 | |
| 14 | +it("accepts the gateway schema rejection wrapper in reject mode", () => { |
| 15 | +expect( |
| 16 | +testing.validateRejectResult({ |
| 17 | +ok: false, |
| 18 | +error: new Error( |
| 19 | +`GatewayClientRequestError: FailoverError: ${testing.DEFAULT_GATEWAY_SCHEMA_ERROR}.`, |
| 20 | +), |
| 21 | +}), |
| 22 | +).toContain(testing.DEFAULT_GATEWAY_SCHEMA_ERROR); |
| 23 | +}); |
| 24 | + |
14 | 25 | it("fails reject mode when the agent run unexpectedly succeeds", () => { |
15 | 26 | expect(() => |
16 | 27 | testing.validateRejectResult({ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。