TECHNOLOGY

When is a partial streamed answer a failed turn?

In this article
THE QUICK TAKE

Keep partially streamed text provisional until the request reaches an expected terminal state. Retry as a new attempt when partial output has already been displayed.

An upstream model can emit useful text and then abort. The 26 November LiteLLM v1.108.19 release describes a fix for affected Chat Completions routes, including a hosted vLLM case, where an abort had been represented as an ordinary stop. The maintainers’ pull request also documents tests on selected other routes. The change makes an upstream failure visible to clients that previously treated the visible text as a completed answer.

Identify the commit point in your application

Streaming interfaces often append successive deltas to a message. Persistence can use a separate state such as generating, completed or interrupted, even if the user sees the same text while it is flowing. A tool invocation deserves its own gate: assemble the expected payload, validate it, and check whether the upstream stream reported the required terminal outcome before dispatch. Avoid updating downstream indexes from the partial text while the turn is still uncertain.

Exercise a normal finish and an upstream abort

Have a test upstream send the same synthetic prefix in two scenarios, then end one normally and signal an abort in the other. Record the events your existing SDK surfaces and the final turn state. Compare a client that accumulates text with one that also parses the terminal event. Check the browser, the persistence layer and the user-facing retry action. Test the actual adapter and endpoint used in production rather than inferring their behavior from another route.

Decide who can retry

If a gateway has already sent text to the client, replaying through a second provider under the same visible answer can leave it unclear which model generated each fragment. Keep the first result labelled interrupted and give the second attempt its own identifier. Where any side effects may already have run, use the application’s existing idempotency and review rules. The relevant metric is now the share of unfinished turns that your application can recognise and handle.

Separate transport status from completion status

An HTTP success status acknowledges the start of an SSE response; a failure later in that response cannot retroactively change those headers. Keep the latest transport and generation statuses on the request record. Clients with a text-only integration may also need to change how the error is presented. The most useful staging test observes whether retry clears the unfinished output and recovers the requested task without presenting the first answer as final.

Sources

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles