You'll notice
Headless mode no longer aborts mid-stream on a write failure, instead flushes queued messages first
What
In headless mode (-p, non-interactive), when writing to the stream-json output format fails, Claude Code no longer stops immediately in the middle of the output loop. Instead, it captures the error, keeps draining any messages still queued for output, and reports the failure only after the loop finishes naturally.
Why
This ensures that queued output messages aren't silently dropped just because one write failed, and the failure is still reported, just after any remaining output has been flushed.