Skip to content

[v5.0] reproduction: resumeStream duplicates the previous assistant message: streaming state - #18494

Draft
ai-sdk-factory[bot] wants to merge 1 commit into
release-v5.0from
bug-reproduction-18457-20260805215613340732
Draft

[v5.0] reproduction: resumeStream duplicates the previous assistant message: streaming state#18494
ai-sdk-factory[bot] wants to merge 1 commit into
release-v5.0from
bug-reproduction-18457-20260805215613340732

Conversation

@ai-sdk-factory

@ai-sdk-factory ai-sdk-factory Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Bug

resumeStream duplicates the previous assistant message: streaming state is seeded from the last message, then the start chunk renames its id and breaks the replace-vs-append check

Reproduction

  • On target release-v5.0 with ai@5.0.228, resumeStream() preserved assistant message a1 and appended server-msg-2 containing both the copied previous answer and the resumed answer.
  • Expected behavior was for the previous answer to appear once and for server-msg-2 to contain only the resumed answer.
  • packages/ai/src/ui/process-ui-message-stream.ts seeds state from the last assistant message, while packages/ai/src/ui/chat.ts appends it after the replayed start chunk changes its ID.
  • The runnable reproduction is examples/ai-functions/src/reproduction/issue-18457-resume-stream-duplicates-previous-message.ts, with its package harness at examples/ai-functions/package.json.

Relevant Documentation

Related Issues

Reproduces #18457

Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant