During streaming, pi pushes the partial assistant message into the context array immediately and replaces that same slot as deltas arrive, swapping in the finalized message at the end. At any interruption point the context contains a structurally complete message rather than a dangling stream, so abort-and-resume never corrupts the transcript.
Related: