Streaming to the Client
UntestedOpenAIServingChat.chat_completion_stream_generator iterates the async generator AsyncLLM.generate() yields into, and turns each RequestOutput into one data: line, closing with data: [DONE]. Exactly one bare continue skips an output, and its condition is a conjunction of three things all being simultaneously true: no delta text, no token ids, and nothing previously sent for that choice — the comment names it directly as the chunked-prefill case, a forward pass over prompt tokens that produced no generated token to report at all. A held-back byte-fallback token is not this case: it has a real token id even though its delta text is empty, so the second clause of the conjunction is false, the continue does not fire, and an ordinary frame is written with empty delta content. On the consumer side, AsyncLLM.generate drains the per-request collector with q.get_nowait() or await q.get() — a fast path that only suspends when the collector is genuinely empty, since whatever is already sitting there already reflects everything accumulated so far. When a client disconnects, the HTTP framework's cancellation (or garbage collection of an abandoned generator) raises inside this same call stack; the except clause aborts the request and lets that abort travel back across the process boundary to free its KV blocks.