The ReadableStream cancel() callback is not reliably invoked on client disconnect under Next.js, causing emitter listeners (line/clear) and the keepalive interval to accumulate, eventually triggering MaxListenersExceededWarning. Use request.signal as the primary disconnect trigger, with cancel() and enqueue failures as fallbacks. Cleanup is idempotent via state.closed. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>