diff --git a/src/servers/sidecar/create-proxy.ts b/src/servers/sidecar/create-proxy.ts index b0fa94f5..a3984412 100644 --- a/src/servers/sidecar/create-proxy.ts +++ b/src/servers/sidecar/create-proxy.ts @@ -157,7 +157,21 @@ export function createSidecarProxy({ const server = ctx.env as { timeout?: (req: Request, seconds: number) => void } | undefined; // `0` disables the idle timeout. With the switch on, an undeclared plugin falls back to the server's // own 60s default by not being touched at all. - const inbound = TIMEOUTS_ON ? timeoutSeconds : (timeoutSeconds ?? 0); + /* + Bun stores a per-request timeout in ONE BYTE. Anything above 255 seconds is clamped to 255 — so a + plugin declaring a generous 1800 got a SHORTER timeout than a plugin declaring nothing at all, which + falls through to 0 and is unlimited. Declaring the fix is what armed the bomb. + + That is what killed every long transcription: 1800 became 255, the upload took a second, and the + connection dropped at 4m16s while whisperx went on and finished the job into a dead socket. Six + plugins declare more than 255 — transcribe and email at 1800, music at 1800, jellyfin at 3600, + minesweeper and photos at 600 — and all six were getting 255. + + So anything Bun cannot represent becomes 0: a plugin asking for longer than Bun's maximum is asking + for "do not cut this off", and 0 is the only value that means it. + */ + const requested = TIMEOUTS_ON ? timeoutSeconds : (timeoutSeconds ?? 0); + const inbound = requested !== undefined && requested > 255 ? 0 : requested; if (inbound !== undefined) { try { server?.timeout?.(ctx.req.raw, inbound);