Skip to content

A provider stream that dies mid-generation ends the turn silently (no error, no retry) #542

Closed

Description

@agenteinstinct1-max

When the provider connection drops mid-generation (observed with OpenCode Zen stream deaths), the AI SDK synthesizes a step-finish with reason unknown and the turn just stops: the assistant message completes with finish unknown, no error is recorded, nothing is retried, and the UI shows no retry/stall marker. From the user's side the run simply died.

Expected: a stream that ends without a definitive finish reason is a retryable stream failure - it should enter the standard retry pipeline (backoff + the retry status indicator) and only surface a terminal error after retries are exhausted.

Reproduced with a failing test: mock LLM stream fails mid-generation -> loop returns after a single request with no error instead of retrying.

Note: the reasoning watchdog's own timeout error (reasoning stream timed out after 1m without new tokens) is already classified retryable; the gap is the silent premature-end path.

Activity

  1. agenteinstinct1-max commented on Oct 23, 2026

    @agenteinstinct1-max
    CollaboratorAuthor

    Fixed by squash merge 485ae47 (PR #544): turns whose provider stream dies mid-generation are now detected and retried, with the step finish-reason witness reset at every step start so a completed step is never mistaken for a stream cut.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions