Canonical: https://www.startearly.ai/case-files/pydantic-ai/stream-drain-loop/
Updated: 2026-11-14

# Pydantic AI Streaming Regression Case File | Early

## A streaming response could end before the model did.

Regression Case File

Pydantic AI v1.92.0 could return an incomplete or empty agent response when a supplied stream handler returned early. Fourteen releases were affected before v1.106.0 restored the behavior.

## Release

**Baseline:** v1.91.0

**Introduced:** v1.92.0

**Last Affected:** v1.105.0

**Restored:** v1.106.0

**Affected Release Count:** 14

### Report

**Reported By:** User

**Delay Days:** 26

**Fix Delay Days:** 28

## Regression

The release looked complete.

The response was not.

Agent responses could be incomplete.

**Changed:** A cancellation cleanup removed the normal completion-path drain loop. If an event stream handler returned before consuming every event, remaining events were not drained into the final response. Tool calls could disappear and usage could read zero.

**Relationship:** Model provider → event stream → event_stream_handler → ModelResponse

The behavior changed when a handler returned before consuming the full stream.

## Replay

The recorded historical analysis compared v1.91.0 with v1.92.0.

The run reported **5 Expected** and **1 Regression** findings.

“Expected” means behavior Early classified as expected, not the number of bugs it expected to find. “Regression” identifies behavior classified as a defect relative to the baseline. These labels describe this run; the counts are not recall or accuracy measurements. The verification evidence below establishes which defects were corroborated.

**Finding Title:** Removed forced drain truncates usage on early exit

**Finding Summary:** Early traced the incomplete response to the removed drain loop and proposed a focused verification. The reproduction passed on v1.91.0, failed on v1.92.0, and passed again on v1.106.0.

The actual Regression finding from the Early product.

### Public Report

[Public issue #5769](https://github.com/pydantic/pydantic-ai/issues/5769)

### Introducing Change

[Introducing PR #5313](https://github.com/pydantic/pydantic-ai/pull/5313)

### Upstream fix

[Upstream fix PR #5771](https://github.com/pydantic/pydantic-ai/pull/5771)

**Disclosure:** Independent replay. Not affiliated with Pydantic.

[Technical article](https://www.startearly.ai/post/pydantic-ai-regression-release-replay/)

## Source and next step

[Read the canonical page and its evidence](https://www.startearly.ai/case-files/pydantic-ai/stream-drain-loop/).
