pub fn classify_stream_failure(
events: &[StreamEvent],
first_event_elapsed_ms: Option<u64>,
total_elapsed_ms: u64,
) -> Option<FailureClass>Expand description
Pure streaming acceptance over a fully read event stream. None means
every acceptance criterion holds: first valid event within 20 s, at least
one content delta, a terminal chunk with a finish reason, no protocol
error, total duration under the configured timeout.
Terminal-chunk policy: a second finish_reason is tolerated when it
repeats the SAME reason on an empty delta (DeepSeek re-emits the terminal
as the final usage-carrying chunk before [DONE] - the live smoke run
observed finish_reason:"stop" twice). A conflicting second reason, or
any content delta delivered AFTER a terminal chunk, is a protocol error.