Skip to content

fix: Bun.write with new Response(req.body) no longer hangs#28112

Closed
robobun wants to merge 1 commit into
mainfrom
claude/fix-bun-write-response-body-hang-v2
Closed

fix: Bun.write with new Response(req.body) no longer hangs#28112
robobun wants to merge 1 commit into
mainfrom
claude/fix-bun-write-response-body-hang-v2

fix(Bun.write): pipe ReadableStream-backed Response/Request bodies to…

a2a7c97
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed May 12, 2026 in 20m 53s

Code review found 1 important issue

Found 5 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 1
🟡 Nit 0
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important src/runtime/webcore/FileSink.zig:68-71 FileSink.Options.flags() O_TRUNC change affects Bun.file().writer(), creates POSIX/Windows divergence

Annotations

Check failure on line 71 in src/runtime/webcore/FileSink.zig

See this annotation in the file changed.

@claude claude / Claude Code Review

FileSink.Options.flags() O_TRUNC change affects Bun.file().writer(), creates POSIX/Windows divergence

Honoring `truncate` here is correct for `pipeReadableStreamToBlob`, but `flags()` is also reached from `Bun.file(path).writer()` on POSIX (Blob.zig:3008-3019 → `sink.start()` → `setup()` → `openForWriting(..., options.flags(), ...)`), so that API now opens with `O_TRUNC` where it previously did not. The Windows `getWriter` branch (Blob.zig:~2935) still opens with `WRONLY | CREAT | NONBLOCK` and bypasses `flags()`, so this introduces a POSIX-vs-Windows divergence for `Bun.file().writer()` — worth