From b9a697925eafa7100f1972b03b6985d5ea455277 Mon Sep 17 00:00:00 2001 From: misterdas Date: Wed, 18 Feb 2026 11:56:23 +0530 Subject: [PATCH] fix(open-sse): emit [DONE] in passthrough SSE mode (#142) --- open-sse/utils/stream.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/open-sse/utils/stream.js b/open-sse/utils/stream.js index bcfff891..83f48713 100644 --- a/open-sse/utils/stream.js +++ b/open-sse/utils/stream.js @@ -253,6 +253,14 @@ export function createSSEStream(options = {}) { appendRequestLog({ model, provider, connectionId, tokens: null, status: "200 OK" }).catch(() => { }); } + // IMPORTANT: In passthrough mode we still must terminate the SSE stream. + // Some clients (e.g. OpenClaw) expect the OpenAI-style sentinel: + // data: [DONE]\n\n + // Without it they can hang until timeout and trigger failover. + const doneOutput = "data: [DONE]\n\n"; + reqLogger?.appendConvertedChunk?.(doneOutput); + controller.enqueue(sharedEncoder.encode(doneOutput)); + if (onStreamComplete) { onStreamComplete({ content: accumulatedContent,