Scope
Implement native server backpressure and drain behavior for streamed response bodies. The unchanged Bun corpus currently fails five cases covering ReadableStream, async-generator, and direct-stream producers, including flush(true) re-entry and queued small writes.
Evidence
Validated against Bun checkout 4982b91e3702094330f3be3883354c52b8c01323 in test/js/bun/http/serve.test.ts. The complete Home run reports 188 pass, 1 upstream skip, 1 upstream todo, and 11 failures; five failures belong to this backpressure family.
Acceptance criteria
- Signal backpressure when clients stall rather than consuming unbounded producer output.
- Resume production after drain and deliver the complete body without corruption.
- Prevent direct-stream pull re-entry while
flush(true)is pending. - Preserve small queued writes across backpressure and drain.
- Pass all unchanged upstream stress workloads and timing assertions without rewrites, skips, relaxed deadlines, or reduced payloads.