Skip to content

refactor: replace createUIMessageStream + writer.merge with toUIMessageStreamResponse#805

Merged
miurla merged 2 commits into
mainfrom
refactor/simplify-stream-response
Apr 9, 2026
Merged

refactor: replace createUIMessageStream + writer.merge with toUIMessageStreamResponse#805
miurla merged 2 commits into
mainfrom
refactor/simplify-stream-response

Conversation

@miurla
Copy link
Copy Markdown
Owner

@miurla miurla commented Apr 9, 2026

Summary

  • Replace createUIMessageStream + writer.merge(result.toUIMessageStream()) with result.toUIMessageStreamResponse() in both chat and ephemeral stream handlers
  • Remove UIMessageStreamWriter, createUIMessageStream, and createUIMessageStreamResponse imports
  • Move onFinish, messageMetadata, and onError directly into toUIMessageStreamResponse() options

Closes #804

Test plan

  • bun typecheck passes
  • bun lint passes
  • bun format:check passes
  • bun run test passes (167 tests)
  • Manual: verify streaming, metadata (traceId, searchMode, modelId), and chat persistence work correctly

…geStreamResponse

Simplify streaming by using result.toUIMessageStreamResponse() directly,
eliminating the manual createUIMessageStream execute/writer pattern.
Closes #804
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
morphic Ready Ready Preview, Comment Apr 9, 2026 7:10am

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac3616d6b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/streaming/create-chat-stream-response.ts Outdated
@miurla miurla merged commit 37b0c1c into main Apr 9, 2026
8 checks passed
@miurla miurla deleted the refactor/simplify-stream-response branch April 9, 2026 07:11
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.

refactor: simplify streaming with toUIMessageStreamResponse, eliminating manual writer.merge

1 participant