From f0629ddce2bbdc6b1942ccbb788a1c6ef3a38598 Mon Sep 17 00:00:00 2001 From: ranxianglei Date: Tue, 27 Oct 2026 00:21:31 +0800 Subject: [PATCH] test(e2e): scripted compress calls use the canonical single-string form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #4823 narrowed the advertised compress schema to the single string form (content: string). Hosts validate tool arguments against the advertised schema client-side, so the scripted array-form calls die before reaching bili's lenient parser: - opencode native lane: 'Invalid arguments for tool compress: content: Expected string' -> e2e-native-opencode red on master - pi codex-responses WS lane: same family -> e2e-pi-codex-ws red on master - OpenCode V2 Responses WS lane: same scripted shape Switch the scripted calls to the canonical '– topic' header line with the summary on the following line (the format the parser requires). dsh-native keeps the array form on purpose: dsh does not client-validate, so that lane now doubles as coverage for the legacy array acceptance path. --- tests/e2e/e2e-opencode-responses-ws.test.ts | 2 +- tests/e2e/e2e-pi-codex-ws.test.ts | 6 +++--- tests/e2e/fake-upstream-chat.mjs | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/e2e/e2e-opencode-responses-ws.test.ts b/tests/e2e/e2e-opencode-responses-ws.test.ts index 9c475bcadc..64b9b08038 100644 --- a/tests/e2e/e2e-opencode-responses-ws.test.ts +++ b/tests/e2e/e2e-opencode-responses-ws.test.ts @@ -128,7 +128,7 @@ test(`real OpenCode V2: native Responses WebSockets, fold and post-fold tools ($ assert.ok(ref); assert.ok(main.some(row => row.full.some(item => item.type === "function_call_output" && String(item.output).includes("ACP Context Analysis")))); for (let i = 0; i < 3; i++) await ocRun(`push-back round ${i}`, sid as string); - const foldArgs = { content: [{ startId: ref, endId: ref, summary: "E2E-WS-SUMMARY: the original material consisted of deterministic bulky filler and established the WebSocket ACP integration test context." }] }; + const foldArgs = { content: `${ref}–${ref} fold\nE2E-WS-SUMMARY: the original material consisted of deterministic bulky filler and established the WebSocket ACP integration test context.` }; await ocRun(`WS_FOLD_REQUEST_B64 ${Buffer.from(JSON.stringify(foldArgs)).toString("base64")}`, sid as string); const afterFold = rows.filter(row => row.transport === "ws" && row.full.some(item => item.type === "function_call_output" && String(item.output).includes("Compressed"))); assert.equal(afterFold.length, 2); diff --git a/tests/e2e/e2e-pi-codex-ws.test.ts b/tests/e2e/e2e-pi-codex-ws.test.ts index 5f1ca925dd..e73027ad06 100644 --- a/tests/e2e/e2e-pi-codex-ws.test.ts +++ b/tests/e2e/e2e-pi-codex-ws.test.ts @@ -512,7 +512,7 @@ test("A: explicit websocket — intercepted, stamped, compress/decompress round assert.ok(sentinelRef, "sentinel message carries an ACP ref tag"); const minRef = userRefs.reduce((a, b) => (Number(a.slice(1)) < Number(b.slice(1)) ? a : b)); - ok("fold", await piRun(ctx, `WS_FOLD_REQUEST_B64 ${b64({ content: [{ startId: minRef, endId: sentinelRef, summary: SUMMARY }] })}`, { resume: true })); + ok("fold", await piRun(ctx, `WS_FOLD_REQUEST_B64 ${b64({ content: `${minRef}–${sentinelRef} fold\n${SUMMARY}` })}`, { resume: true })); const foldedRow = mock.rows.filter((r) => r.transport === "ws").find((r) => toolResult(r, "compress")?.includes("Compressed")); assert.ok(foldedRow, "compress executed and reported the fold"); @@ -585,7 +585,7 @@ test("B: auto — successful WS still routes, previous_response_id continuation assert.ok(sentinelRef && userRefs.length >= 2, `user-message ACP refs present (${userRefs.length})`); const minRef = userRefs.reduce((a, b) => (Number(a.slice(1)) < Number(b.slice(1)) ? a : b)); - ok("fold", await piRun(ctx, `WS_FOLD_REQUEST_B64 ${b64({ content: [{ startId: minRef, endId: sentinelRef, summary: SUMMARY }] })}`, { resume: true })); + ok("fold", await piRun(ctx, `WS_FOLD_REQUEST_B64 ${b64({ content: `${minRef}–${sentinelRef} fold\n${SUMMARY}` })}`, { resume: true })); // Delta frames emerge inside multi-call tool-loop processes (pi's // websocketSessionCache is per-process): A/E show them on the final call of @@ -688,7 +688,7 @@ test("D: explicit sse — regression guard, full fold cycle over HTTP", { skip: assert.ok(sentinelRef && userRefs.length >= 2, `user-message ACP refs present (${userRefs.length})`); const minRef = userRefs.reduce((a, b) => (Number(a.slice(1)) < Number(b.slice(1)) ? a : b)); - ok("fold", await piRun(ctx, `WS_FOLD_REQUEST_B64 ${b64({ content: [{ startId: minRef, endId: sentinelRef, summary: SUMMARY }] })}`, { resume: true })); + ok("fold", await piRun(ctx, `WS_FOLD_REQUEST_B64 ${b64({ content: `${minRef}–${sentinelRef} fold\n${SUMMARY}` })}`, { resume: true })); ok("recall", await piRun(ctx, "final recall", { resume: true })); // Re-capture AFTER fold/recall: preFoldRows is a pre-fold snapshot. diff --git a/tests/e2e/fake-upstream-chat.mjs b/tests/e2e/fake-upstream-chat.mjs index 1034f00761..b56707a7ad 100644 --- a/tests/e2e/fake-upstream-chat.mjs +++ b/tests/e2e/fake-upstream-chat.mjs @@ -114,7 +114,11 @@ function compressArgs(refs) { // zone (last 5 messages / most recent user message). if (refs.length === 0) return {}; const start = refs[0]; - return { content: [{ startId: start, endId: start, summary: "e2e fold: scripted compress round over the run-one filler message" }] }; + // #4823 narrowed the advertised schema to the single string form; hosts + // like opencode/pi validate tool args against it client-side, so the + // scripted call must use the canonical string (the array form is still + // accepted by bili's lenient parser but dies at host validation). + return { content: `${start}–${start} e2e fold\nscripted compress round over the run-one filler message` }; } // A chain-checkpoint carrier ( #1421 step 3) rides as a