From 100b7fcd9f0ad4f9d8a351238cd8cd66b6f0a954 Mon Sep 17 00:00:00 2001 From: Claude Bot Date: Sun, 5 Oct 2025 04:47:12 +0000 Subject: [PATCH] Add setValue calls in doClone to properly initialize Ref with tee'd streams Addresses CodeRabbit review comment: doClone must call setValue on both the original and cloned Request's Locked.readable Ref after setting the GC cache, mirroring the constructor pattern. This ensures the Ref is properly initialized with the tee'd stream value, making the body stream accessible via the owner-aware get() path. --- src/bun.js/webcore/Request.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bun.js/webcore/Request.zig b/src/bun.js/webcore/Request.zig index 5b62858180..db32b0e393 100644 --- a/src/bun.js/webcore/Request.zig +++ b/src/bun.js/webcore/Request.zig @@ -828,10 +828,12 @@ pub fn doClone( if (js_wrapper != .zero) { if (this.body.value == .Locked and readable_stream_tee[0] != .zero) { js.gc.body.set(this_value, globalThis, readable_stream_tee[0]); + this.body.value.Locked.readable.setValue(.{ .Request = this_value }, readable_stream_tee[0], globalThis); } if (cloned.body.value == .Locked and readable_stream_tee[1] != .zero) { js.gc.body.set(js_wrapper, globalThis, readable_stream_tee[1]); + cloned.body.value.Locked.readable.setValue(.{ .Request = js_wrapper }, readable_stream_tee[1], globalThis); } }