From 13143f947e82ada7de265eebf102036a042bdf43 Mon Sep 17 00:00:00 2001 From: awork Date: Wed, 21 Oct 2026 06:33:26 +0800 Subject: [PATCH 1/3] fix: end plugin streams cleanly when a read failure follows an already-forwarded terminal (#4059) --- src/plugin.ts | 59 +++- ...issue4059-post-terminal-read-error.test.ts | 273 ++++++++++++++++++ 2 files changed, 330 insertions(+), 2 deletions(-) create mode 100644 tests/issue4059-post-terminal-read-error.test.ts diff --git a/src/plugin.ts b/src/plugin.ts index e04a08b76c..de9c945757 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -2626,6 +2626,13 @@ export async function pipePluginChatWithStrip( // #498: whether a terminal event ([DONE] / message_stop) was seen. A // stream that ends without one was cut mid-flight. let sawTerminal = false; + // #4059: whether the wire's terminal byte ACTUALLY reached the client + // (openai [DONE], anthropic message_stop, google finish-reason chunk). + // sawTerminal is set at parse time and feeds the degenerate-turn retry; + // this flag is set only after the awaited write succeeds, so a read error + // caught afterwards knows the turn was already complete for the client + // and must end clean instead of appending a duplicate terminator. + let terminalForwarded = false; const maybeWarnDegenerate = () => { if (!sawTerminal || res.destroyed || res.writableEnded) return; let inputChars = 0; @@ -3172,7 +3179,9 @@ export async function pipePluginChatWithStrip( diagEvents++; diagPushType("[DONE]"); sawTerminal = true; + const deliversTerminal = !res.destroyed && !res.writableEnded; await write(flushTails() + rawEvent + "\n\n"); + if (deliversTerminal) terminalForwarded = true; continue; } let ev: Record; @@ -3259,7 +3268,16 @@ export async function pipePluginChatWithStrip( // count before the turn may be called empty. The event's output is // dropped only when the retry takes the turn over. if (turnTerminal !== undefined && (await retryEmptyTurn(turnTerminal))) continue; - if (out.length > 0) await write(offsetRetryIndices(out)); + if (out.length > 0) { + // #4059: anthropic's message_stop IS its terminal byte; + // google's finish-reason chunk IS its terminator. The + // openai terminal byte is [DONE], tracked above. + const deliversTerminalByte = protocol === "anthropic" && ev["type"] === "message_stop" + || protocol === "google" && turnTerminal !== undefined; + const wrote = !res.destroyed && !res.writableEnded; + await write(offsetRetryIndices(out)); + if (deliversTerminalByte && wrote) terminalForwarded = true; + } } } if (done) break; @@ -3306,6 +3324,14 @@ export async function pipePluginChatWithStrip( log?.("client aborted mid-stream"); return; } + // #4059: the terminal byte already reached the client — the turn is + // complete from the client's side. A read failure after it is + // transport noise, not truncation: synthesize nothing (a duplicate + // [DONE]/message_stop would violate strict lifecycle validation). + if (terminalForwarded) { + loggerLog("warn", `[plugin] upstream stream read failed (${protocol}): ${String(e instanceof Error ? e.message : e)} — terminal byte already forwarded, ending clean without a duplicate terminator (#4059)`); + return; + } // #721: upstream read failed while the client is still connected — // deliver the in-band truncation signal instead of rethrowing into // the top-level handler, which would close the stream bare. Flush @@ -3601,6 +3627,13 @@ export async function pipePluginResponsesWithStrip( // #498: whether a terminal event (done-family / [DONE]) was seen. A // stream that ends without one was cut mid-flight. let sawTerminal = false; + // #4059: whether a completion-family frame (or [DONE]) ACTUALLY reached + // the client. Set only after the awaited write succeeds — sawTerminal is + // set at parse time and feeds retryEmptyTurn, which can drop the frame — + // so only this flag answers "is the turn complete for the client?". A + // read failure caught after it must end clean, never append the + // contradictory upstream_stream_truncated error. + let terminalForwarded = false; const maybeWarnDegenerate = () => { if (!sawTerminal || res.destroyed || res.writableEnded) return; const st = tagFilter.stats(); @@ -3883,12 +3916,15 @@ export async function pipePluginResponsesWithStrip( if (dataLines.length === 0) continue; const jsonStr = dataLines.map((l) => l.slice(5).replace(/^ /, "")).join("\n").trim(); if (!jsonStr || jsonStr === "[DONE]") { - if (jsonStr === "[DONE]") { + const isDone = jsonStr === "[DONE]"; + if (isDone) { diagEvents++; diagPushType("[DONE]"); sawTerminal = true; } + const deliversTerminal = isDone && !res.destroyed && !res.writableEnded; await write(rawEvent + "\n\n"); + if (deliversTerminal) terminalForwarded = true; continue; } let ev: Record; @@ -4037,7 +4073,15 @@ export async function pipePluginResponsesWithStrip( recordContextObservation(session, Math.max(0, acc.inputTokens - credit), credit > 0 ? "estimate" : "usage"); markDirty(session); } + // #4059: the completion-family frame IS the turn's + // terminal for the client (completed stays completed, + // failed/incomplete keep their own status — nothing is + // re-voiced here). Track delivery so a read failure + // caught afterwards ends clean instead of appending + // a contradictory truncation error. + const deliversTerminal = !res.destroyed && !res.writableEnded; await write(rebuild ? rebuildEvent(rawEvent, evOut) : rawEvent + "\n\n"); + if (deliversTerminal) terminalForwarded = true; continue; } if (type === "response.output_text.delta" && typeof ev["delta"] === "string") { @@ -4129,6 +4173,17 @@ export async function pipePluginResponsesWithStrip( log?.("client aborted mid-stream"); return; } + // #4059: the completion-family frame already reached the client — the + // turn is complete from the client's side. A read failure after it is + // transport noise, not truncation: retain the forwarded terminal + // result and end clean instead of appending the contradictory + // upstream_stream_truncated error. Held tails are empty by + // construction here (the terminal branch flushed them first), so + // nothing is dropped by skipping the flush below. + if (terminalForwarded) { + loggerLog("warn", `[plugin] upstream stream read failed (responses): ${String(e instanceof Error ? e.message : e)} — terminal already forwarded, ending clean without a truncation signal (#4059)`); + return; + } // #721: upstream read failed while the client is still connected — // deliver the in-band truncation signal instead of rethrowing into // the top-level handler, which would close the stream bare. Flush diff --git a/tests/issue4059-post-terminal-read-error.test.ts b/tests/issue4059-post-terminal-read-error.test.ts new file mode 100644 index 0000000000..e308b4a7b8 --- /dev/null +++ b/tests/issue4059-post-terminal-read-error.test.ts @@ -0,0 +1,273 @@ +import { test, beforeEach, afterEach } from "node:test"; +import assert from "node:assert/strict"; +import { createInitialState } from "acp-kernel"; +import type { Session } from "../src/session.ts"; +import { pipePluginChatWithStrip, pipePluginResponsesWithStrip } from "../src/plugin.ts"; +import { setLogCapture } from "../src/logger.ts"; + +// #4059: a read failure AFTER the turn's terminal event was already forwarded +// is transport noise, not truncation. Pre-fix, the responses catch path +// appended a contradictory `upstream_stream_truncated` error frame after +// response.completed (and its diagnostic self-reported "no-terminal-seen"), +// making clients retry or stop an already-finished turn; the chat-pipe twin +// re-sent a duplicate [DONE]/message_stop instead. This suite pins BOTH +// directions of the gate: post-terminal failures end clean, genuine +// pre-terminal failures keep the in-band signal (or its finished= synthesis), +// and a terminal consumed by the empty-turn retry (never forwarded) still +// raises the signal when the retry stream is cut. + +function makeRes(chunks: string[]) { + let ended = 0; + const r = { + write(b: Buffer | string) { + chunks.push(typeof b === "string" ? b : b.toString("utf8")); + return true; + }, + end(b?: Buffer | string) { + ended++; + if (b !== undefined) chunks.push(typeof b === "string" ? b : b.toString("utf8")); + }, + once() {}, + destroyed: false, + writableEnded: false, + get endedCount() { + return ended; + }, + }; + return r as unknown as import("node:http").ServerResponse & { endedCount: number }; +} + +function streamOf(events: string[], then?: "error"): ReadableStream { + const enc = new TextEncoder(); + let i = 0; + return new ReadableStream({ + pull(controller) { + if (i < events.length) { + controller.enqueue(enc.encode(events[i])); + i += 1; + } else if (then === "error") { + controller.error(new Error("terminated")); + } else { + controller.close(); + } + }, + }); +} + +function failingStream(err: Error): ReadableStream { + return new ReadableStream({ + start(controller) { + controller.error(err); + }, + }); +} + +function makeSession(metadata: Record = {}): Session { + return { + id: "sess-4059", + meta: {}, + stats: { + requests: 0, + tokensSaved: 0, + inputTokens: 0, + cachedTokens: 0, + outputTokens: 0, + cacheSamples: 0, + lastInputTokens: 0, + compressCreditTokens: 0, + contextTokens: 0, + retrieveCalls: 0, + retrieveHits: 0, + retrieveMisses: 0, + storedBytes: 0, + storeBytesSaved: 0, + rangeRestores: 0, + }, + pendingRetrievals: [], + metadata, + state: createInitialState(), + createdAt: Date.now(), + lastSeen: Date.now(), + blockContents: new Map(), + inFlight: 0, + persisted: false, + }; +} + +const sse = (e: string, d: Record) => `event: ${e}\ndata: ${JSON.stringify({ type: e, ...d })}\n\n`; + +const responsesTurn = (terminal: "response.completed" | "response.failed" | "response.incomplete") => [ + sse("response.created", { response: { id: "resp_1", status: "in_progress" } }), + sse("response.output_item.added", { output_index: 0, item: { type: "message", id: "msg_1", role: "assistant", content: [] } }), + sse("response.content_part.added", { item_id: "msg_1", output_index: 0, part: { type: "output_text", text: "" } }), + sse("response.output_text.delta", { item_id: "msg_1", output_index: 0, delta: "ok" }), + sse("response.output_text.done", { item_id: "msg_1", output_index: 0, text: "ok" }), + sse("response.content_part.done", { item_id: "msg_1", output_index: 0, part: { type: "output_text", text: "ok" } }), + sse("response.output_item.done", { output_index: 0, item: { type: "message", id: "msg_1", role: "assistant", content: [{ type: "output_text", text: "ok" }] } }), + sse(terminal, { response: { id: "resp_1", status: terminal.split(".")[1] } }), +]; + +let logs: string[] = []; +// Gate-action lines (retry takeover, terminal-byte synthesis) ride the +// per-request `log` callback, not loggerLog — collect both into one list. +const logLine = (m: string) => logs.push(m); +beforeEach(() => { + logs = []; + setLogCapture((level, msg) => logs.push(`${level} ${msg}`)); +}); +afterEach(() => { + setLogCapture(null); +}); + +for (const terminal of ["response.completed", "response.failed", "response.incomplete"] as const) { + test(`#4059 responses: read error after forwarded ${terminal} ends clean — no truncation frame`, async () => { + const out: string[] = []; + const res = makeRes(out); + await pipePluginResponsesWithStrip(streamOf(responsesTurn(terminal), "error"), res, makeSession({ pluginAgent: "dsh" })); + const wire = out.join(""); + assert.ok(wire.includes(`"type":"${terminal}"`), "terminal frame forwarded"); + assert.ok(wire.includes(`"status":"${terminal.split(".")[1]}"`), "terminal keeps its own status"); + assert.ok(!wire.includes("upstream_stream_truncated"), "no contradictory truncation error"); + assert.ok(!wire.includes("event: error"), "no synthetic error event"); + assert.ok(logs.some((l) => l.includes("terminal already forwarded")), "guarded catch branch logged"); + assert.equal(res.endedCount, 1, "stream still closed exactly once"); + }); +} + +test("#4059 responses: [DONE]-terminated stream + post-[DONE] read error ends clean", async () => { + const out: string[] = []; + await pipePluginResponsesWithStrip( + streamOf([sse("response.created", { response: { id: "resp_1" } }), "data: [DONE]\n\n"], "error"), + makeRes(out), + makeSession({ pluginAgent: "dsh" }), + ); + const wire = out.join(""); + assert.equal((wire.match(/data: \[DONE\]/g) ?? []).length, 1, "terminal delivered exactly once"); + assert.ok(!wire.includes("upstream_stream_truncated"), "no truncation error after [DONE]"); +}); + +test("#4059 responses contrast: cut BEFORE the terminal keeps the in-band error", async () => { + const out: string[] = []; + await pipePluginResponsesWithStrip(streamOf(responsesTurn("response.completed").slice(0, 4), "error"), makeRes(out), makeSession({ pluginAgent: "dsh" })); + const wire = out.join(""); + assert.ok(wire.includes("upstream_stream_truncated"), "genuine cut still signals"); + assert.ok(wire.includes("event: error"), "error event still emitted"); + assert.ok(wire.includes('"classification":"no-terminal-seen"'), "diagnostic stays accurate"); +}); + +test("#4059 responses contrast: malformed terminal frame + read error keeps the in-band error", async () => { + const events = [ + ...responsesTurn("response.completed").slice(0, 7), + 'data: {"type":"response.complet\n\n', + ]; + const out: string[] = []; + await pipePluginResponsesWithStrip(streamOf(events, "error"), makeRes(out), makeSession({ pluginAgent: "dsh" })); + const wire = out.join(""); + assert.ok(wire.includes("upstream_stream_truncated"), "unparseable terminal is not a terminal — signal kept"); + assert.ok(wire.includes('"classification":"no-terminal-seen"')); +}); + +test("#4059 responses: normal completion + clean EOF unchanged", async () => { + const out: string[] = []; + await pipePluginResponsesWithStrip(streamOf(responsesTurn("response.completed")), makeRes(out), makeSession()); + const wire = out.join(""); + assert.ok(wire.includes('"type":"response.completed"')); + assert.ok(!wire.includes("upstream_stream_truncated")); + assert.ok(!logs.some((l) => l.includes("terminal already forwarded")), "clean EOF never hits the guarded branch"); +}); + +test("#4059 responses: terminal consumed by empty-turn retry, retry stream cut → signal still fires", async () => { + // The first attempt ends in a compression-draft closing tag with no + // function call: retryEmptyTurn consumes the completed frame (client + // never sees it) and swaps in the refetched stream, which is cut here. + const first = [ + ...responsesTurn("response.completed").slice(0, 3), + sse("response.output_text.delta", { item_id: "msg_1", output_index: 0, delta: "draft " }), + sse("response.output_text.done", { item_id: "msg_1", output_index: 0, text: "draft " }), + sse("response.content_part.done", { item_id: "msg_1", output_index: 0, part: { type: "output_text", text: "draft " } }), + sse("response.output_item.done", { output_index: 0, item: { type: "message", id: "msg_1", role: "assistant", content: [{ type: "output_text", text: "draft " }] } }), + sse("response.completed", { response: { id: "resp_1", status: "completed" } }), + ]; + const out: string[] = []; + await pipePluginResponsesWithStrip( + streamOf(first), + makeRes(out), + makeSession({ pluginAgent: "dsh" }), + logLine, + async () => failingStream(new Error("terminated")), + ); + const wire = out.join(""); + assert.ok(logs.some((l) => l.includes("retrying once")), "empty-turn retry took over"); + assert.ok(!wire.includes('"type":"response.completed"'), "consumed terminal never reached the client"); + assert.ok(wire.includes("upstream_stream_truncated"), "a cut retry stream is still a truncation"); +}); + +const DONE = "data: [DONE]\n\n"; +const chunk = (fr: string | null, content?: string) => `data: ${JSON.stringify({ object: "chat.completion.chunk", choices: [{ index: 0, delta: fr === null ? (content !== undefined ? { content } : {}) : {}, finish_reason: fr }] })}\n\n`; + +test("#4059 openai: read error after forwarded [DONE] → exactly one [DONE], no error frame", async () => { + const out: string[] = []; + const res = makeRes(out); + await pipePluginChatWithStrip(streamOf([chunk(null, "hi"), chunk("stop"), DONE], "error"), res, "openai", makeSession({ pluginAgent: "dsh" })); + const wire = out.join(""); + assert.equal((wire.match(/data: \[DONE\]/g) ?? []).length, 1, "terminal byte delivered exactly once"); + assert.ok(!wire.includes("upstream_stream_truncated"), "no synthetic error after [DONE]"); + assert.ok(logs.some((l) => l.includes("terminal byte already forwarded")), "guarded catch branch logged"); + assert.equal(res.endedCount, 1); +}); + +test("#4059 openai contrast: finish reason delivered but [DONE] lost → [DONE] still synthesized", async () => { + const out: string[] = []; + await pipePluginChatWithStrip(streamOf([chunk(null, "hi"), chunk("stop")], "error"), makeRes(out), "openai", makeSession({ pluginAgent: "dsh" }), logLine); + const wire = out.join(""); + assert.equal((wire.match(/data: \[DONE\]/g) ?? []).length, 1, "synthesized terminal byte preserved"); + assert.ok(!wire.includes("upstream_stream_truncated"), "finished=true stays silent-completion, not an error"); + assert.ok(logs.some((l) => l.includes("synthesizing missing terminal byte"))); +}); + +test("#4059 openai contrast: cut before any finish reason keeps the in-band error", async () => { + const out: string[] = []; + await pipePluginChatWithStrip(streamOf([chunk(null, "hi")], "error"), makeRes(out), "openai", makeSession({ pluginAgent: "dsh" }), logLine); + const wire = out.join(""); + // OpenAI-wire truncation is a top-level `error` object followed by a + // terminal [DONE] (never an `event: error` line — that's the responses + // and anthropic wires). + const errIdx = wire.indexOf('"code":"upstream_stream_truncated"'); + assert.ok(errIdx >= 0, "genuine cut still signals"); + const doneIdx = wire.indexOf("data: [DONE]"); + assert.ok(doneIdx > errIdx, "terminal byte lands after the error frame"); + assert.equal((wire.match(/data: \[DONE\]/g) ?? []).length, 1); +}); + +const ev = (type: string, data: Record) => `event: ${type}\ndata: ${JSON.stringify(data)}\n\n`; + +const anthropicFrames = (withStop: boolean) => { + const frames = [ + ev("message_start", { type: "message_start", message: { id: "msg_a", type: "message", role: "assistant", content: [], stop_reason: null, stop_sequence: null, usage: { input_tokens: 10, cache_read_input_tokens: 0 } } }), + ev("content_block_start", { type: "content_block_start", index: 0, content_block: { type: "text", text: "" } }), + ev("content_block_delta", { type: "content_block_delta", index: 0, delta: { type: "text_delta", text: "hi" } }), + ev("content_block_stop", { type: "content_block_stop", index: 0 }), + ev("message_delta", { type: "message_delta", delta: { stop_reason: "end_turn", stop_sequence: null }, usage: { input_tokens: 10, output_tokens: 3 } }), + ]; + if (withStop) frames.push(ev("message_stop", { type: "message_stop" })); + return frames; +}; + +test("#4059 anthropic: read error after forwarded message_stop → exactly one message_stop, no error frame", async () => { + const out: string[] = []; + const res = makeRes(out); + await pipePluginChatWithStrip(streamOf(anthropicFrames(true), "error"), res, "anthropic", makeSession({ pluginAgent: "dsh" })); + const wire = out.join(""); + assert.equal((wire.match(/"type":"message_stop"/g) ?? []).length, 1, "terminal byte delivered exactly once"); + assert.ok(!wire.includes("upstream_stream_truncated"), "no synthetic error after message_stop"); + assert.ok(logs.some((l) => l.includes("terminal byte already forwarded"))); + assert.equal(res.endedCount, 1); +}); + +test("#4059 anthropic contrast: stop_reason delivered but message_stop lost → message_stop still synthesized", async () => { + const out: string[] = []; + await pipePluginChatWithStrip(streamOf(anthropicFrames(false), "error"), makeRes(out), "anthropic", makeSession({ pluginAgent: "dsh" })); + const wire = out.join(""); + assert.equal((wire.match(/"type":"message_stop"/g) ?? []).length, 1, "synthesized terminal byte preserved"); + assert.ok(!wire.includes("upstream_stream_truncated"), "finished=true stays silent-completion, not an error"); +}); From 25f1fce521c5944f7d505213602e4d4a302913b5 Mon Sep 17 00:00:00 2001 From: awork Date: Wed, 21 Oct 2026 10:09:39 +0800 Subject: [PATCH 2/3] test: pin both gate directions on the google wire for #4059 (review supplement) --- ...issue4059-post-terminal-read-error.test.ts | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/issue4059-post-terminal-read-error.test.ts b/tests/issue4059-post-terminal-read-error.test.ts index e308b4a7b8..080600a199 100644 --- a/tests/issue4059-post-terminal-read-error.test.ts +++ b/tests/issue4059-post-terminal-read-error.test.ts @@ -266,8 +266,38 @@ test("#4059 anthropic: read error after forwarded message_stop → exactly one m test("#4059 anthropic contrast: stop_reason delivered but message_stop lost → message_stop still synthesized", async () => { const out: string[] = []; - await pipePluginChatWithStrip(streamOf(anthropicFrames(false), "error"), makeRes(out), "anthropic", makeSession({ pluginAgent: "dsh" })); + await pipePluginChatWithStrip(streamOf(anthropicFrames(false), "error"), makeRes(out), "anthropic", makeSession({ pluginAgent: "dsh" }), logLine); const wire = out.join(""); assert.equal((wire.match(/"type":"message_stop"/g) ?? []).length, 1, "synthesized terminal byte preserved"); assert.ok(!wire.includes("upstream_stream_truncated"), "finished=true stays silent-completion, not an error"); }); + +// #4059 review supplement: the google wire's terminator IS its finish-reason +// chunk — pin both gate directions there too (pre-fix, a post-terminator read +// error logged the misleading "truncation signal path" line and built a diag +// although no frame was ever appended). +const gchunk = (c: Record) => `data: ${JSON.stringify({ candidates: [c] })}\n\n`; + +test("#4059 google: read error after forwarded finish-reason chunk ends clean — no synthesized frame", async () => { + const out: string[] = []; + const res = makeRes(out); + await pipePluginChatWithStrip( + streamOf([gchunk({ content: { parts: [{ text: "hi" }] } }), gchunk({ content: { parts: [{}] }, finishReason: "STOP" })], "error"), + res, + "google", + makeSession({ pluginAgent: "dsh" }), + ); + const wire = out.join(""); + assert.ok(wire.includes('"finishReason":"STOP"'), "terminator chunk forwarded"); + assert.ok(!wire.includes('"status":"UNAVAILABLE"'), "no synthesized UNAVAILABLE frame after the terminator"); + assert.ok(!wire.includes("upstream_stream_truncated"), "no truncation signal after the terminator"); + assert.ok(logs.some((l) => l.includes("terminal byte already forwarded")), "guarded catch branch logged"); + assert.equal(res.endedCount, 1); +}); + +test("#4059 google contrast: cut BEFORE the finish-reason chunk keeps the UNAVAILABLE frame", async () => { + const out: string[] = []; + await pipePluginChatWithStrip(streamOf([gchunk({ content: { parts: [{ text: "hi" }] } })], "error"), makeRes(out), "google", makeSession({ pluginAgent: "dsh" }), logLine); + const wire = out.join(""); + assert.ok(wire.includes('"status":"UNAVAILABLE"'), "mid-flight cut still signals"); +}); From 720f3387dbcc015d8e55687263013f7f6428c8a9 Mon Sep 17 00:00:00 2001 From: awork Date: Wed, 21 Oct 2026 14:39:48 +0800 Subject: [PATCH 3/3] test(verif): return after t.skip() so solverless shards skip honestly (CI triage #4062) Found while triaging the #4062 CI red: the async test body kept executing after t.skip() because the gate line had no return. On every solverless CI shard it then threw deeper (no-solver error on Linux, doubled-drive-letter ENOENT on Windows), producing a 'not ok ... # SKIP' TAP line that is NOT counted in the failure total but reads like a failure and misled this triage. The return makes the skip honest per the KDD #14 auto-skip contract; behavior with a solver present is unchanged (branch never taken). --- tests/verif-generic-append-stability.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/verif-generic-append-stability.test.ts b/tests/verif-generic-append-stability.test.ts index 748b3b47bd..7dee358e42 100644 --- a/tests/verif-generic-append-stability.test.ts +++ b/tests/verif-generic-append-stability.test.ts @@ -47,7 +47,7 @@ interface TurnOut { test("generic append-only stability: arbitrary inputs over assignRefs + renderVisibleRefs", { timeout: 300_000 }, async (t) => { const haveSolver = (() => { try { return solveSmt2("(set-logic ALL)(check-sat)", []).status === "sat"; } catch { return false; } })(); - if (!haveSolver) t.skip("no SMT solver available (set VERIF_PYTHON or VERIF_SOLVER_CMD)"); + if (!haveSolver) { t.skip("no SMT solver available (set VERIF_PYTHON or VERIF_SOLVER_CMD)"); return; } const ctx = newCtx(); const strv = (v: string) => ({ kind: "str", t: ctx.String.val(v) }) as never;