﻿# LiteLLM LTS propagates cancellation through the Messages stream bridge

The LTS patch closes the upstream iterator when a bridged Messages client leaves. Compare downstream, upstream and usage evidence separately.

Author: Retrivium editorial team
Updated: 2026-11-20
Canonical URL: https://retrivium.ai/journal/daily-20261120-agent-litellm-messages-responses-cancel/
Language: en

LiteLLM 1.108.12 LTS, published November 19, 2026, includes a fix for OpenAI-backed requests served through the Anthropic-style /v1/messages stream. The release notes say upstream streaming could continue after the caller closed its stream. The linked change describes cleanup for the bridge to Responses and for the supported Chat Completions bridge. The practical test begins while the stream is active, before the response finishes normally.

## Observe both boundaries in a test environment

Use an owned gateway and a controlled upstream that emits ordinary text events slowly enough to distinguish active generation from completion. After an ordinary event reaches the test client, close the client stream using its normal cancellation mechanism. Record the request identifier, downstream closure and the corresponding upstream iterator closure using the gateway and test upstream. The client reporting a successful close tells you only what happened on its side.

## Exercise normal completion and early cancellation

Keep a control case that consumes the same response until the end. Compare how the gateway records the terminal state for that control and for cancellation. The control should still receive the expected ending event. The cancelled case should emit cleanup evidence for the request without inventing a completed answer. Run the check with the installed SDK or proxy surface that the application actually uses.

## Distinguish an iterator from a pooled connection

With connection reuse or multiplexing, the underlying connection may hold unrelated traffic. Record the lifecycle of the affected stream or request, and use transport observations as supporting evidence. If another request is running at the same time, confirm it stays usable. Closing the wrong scope can turn a resource cleanup fix into a reliability problem for other callers.

## Verify consumption separately

Upstream stream closure is a useful technical result. A provider may account for tokens it already generated before cancellation. Use observed usage and the applicable billing data before estimating savings. Set distinct acceptance criteria for cleanup, correct terminal status and cost attribution.

## Sources

- [LiteLLM LTS release notes](https://github.com/BerriAI/litellm/releases/tag/v1.108.12)
- [Merged streaming change](https://github.com/BerriAI/litellm/pull/52144)

## Related reading

- [Messages stream translation](/journal/week46-agent-litellm-opencode-messages-chat-stream-bridge/)
- [Stream completion and logging](/journal/week46-agent-litellm-stream-close-before-log-rebuild/)
