From cefb1953764e714d79556e2f8065cfbec78acb86 Mon Sep 17 00:00:00 2001 From: Guilhem Date: Mon, 5 Oct 2026 16:16:22 +0200 Subject: [PATCH] fix: flush proxied responses before the dev supervisor closes the client (#11530) * fix: flush proxied responses before the dev supervisor closes the client Co-Authored-By: Claude Opus 5.5 (1M context) * chore: shorten dev supervisor close-path comment Co-Authored-By: Claude Opus 5.5 (1M context) --------- Co-authored-by: Claude Opus 5.5 (1M context) --- frontend/scripts/dev-supervisor.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/scripts/dev-supervisor.mjs b/frontend/scripts/dev-supervisor.mjs index 4a2c92e1a0..9dc7248d9f 100644 --- a/frontend/scripts/dev-supervisor.mjs +++ b/frontend/scripts/dev-supervisor.mjs @@ -339,8 +339,12 @@ class Target { client.destroy() upstream.destroy() } + // An upstream close must not destroy the client: `destroy` drops bytes still queued + // toward a slow client, truncating the response body. `pipe` already ends the client + // once those bytes are flushed. upstream.on('error', teardown) - upstream.on('close', teardown) + client.on('error', teardown) + upstream.on('close', () => this.liveSockets.delete(client)) client.on('close', teardown) }, (err) => {