declaring a long timeout was giving a shorter one

Bun stores a per-request timeout in ONE BYTE. anything above 255 seconds
clamps to 255 — so a plugin declaring a generous 1800 got a SHORTER
timeout than one declaring nothing at all, which falls through to 0 and is
unlimited. the line meant to fix this is what armed it.

that is what killed every long transcription. 1800 became 255, the upload
took a second, the connection dropped at 4m16s, and whisperx went on and
finished into a dead socket. every time, all night, while three separate
fixes above it were already live and correct.

six plugins declare more than 255 and all six were getting 255:
transcribe, email and music at 1800, jellyfin at 3600, minesweeper and
photos at 600. fixed here rather than by deleting the declaration from one
router, because the other five have the same bomb.

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.

found by the owner, after i had already looked at this file twice.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Officer-Session: 656f5c85-e49a-4f1f-b9f3-042a04b4d043
This commit is contained in:
2026-08-24 22:10:41 +00:00
co-authored by Claude Opus 5
parent 879edbdfb0
commit 236572107b
+15 -1
View File
@@ -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);