Skip to content

fix: reject non-streaming chat on run errors#938

Draft
jan-kubica wants to merge 1 commit into
TanStack:mainfrom
jan-kubica:fix/stream-to-text-run-error
Draft

fix: reject non-streaming chat on run errors#938
jan-kubica wants to merge 1 commit into
TanStack:mainfrom
jan-kubica:fix/stream-to-text-run-error

Conversation

@jan-kubica

Copy link
Copy Markdown
Contributor

Summary

  • reject non-streaming text calls when the provider stream emits RUN_ERROR
  • share the consumer-facing error conversion with StreamProcessor, preserving the provider code and sanitized raw event
  • cover the behavior with a unit regression test and a mocked OpenAI wire-level E2E test

Root cause

streamToText accumulated only text chunks and ignored RUN_ERROR. As a result, chat({ stream: false }) could resolve with empty or partial text after a provider failure, while the streaming UI path surfaced the same failure through onError.

Test plan

  • pnpm test:pr
  • pnpm --filter @tanstack/ai-e2e test:e2e (349 passed, 1 gated live smoke skipped)

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4126f2b7-024b-478d-a831-1752844111ee

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant