Problem
The HMR live-reload EventSource (/_stx/hmr) sent its keepalive comment every 15s, but that is longer than Bun.serve's 10s default idleTimeout (and typical reverse-proxy read timeouts, e.g. rpx). The stream went idle and the connection was killed before the first keepalive ever arrived, so the browser reported net::ERR_INCOMPLETE_CHUNKED_ENCODING and EventSource fell into a reconnect loop — very visible behind the *.localhost HTTPS proxy as repeated failed GET /_stx/hmr.
The original code comment even claimed 15s was "well under any sane idle timeout (Bun's default 10s)" — but 15 > 10.
Fix
Drop the keepalive interval to 5s, comfortably under Bun's 10s default and common proxy read timeouts.
Verified
Streaming /_stx/hmr now emits a keepalive at +5s and +10s (was +15s); the connection stays alive and the reconnect loop is gone.
🤖 Generated with Claude Code