Skip to content

[ai] Return UIMessage[] from DurableAgent stream call#760

Closed
VaguelySerious wants to merge 1 commit intomainfrom
peter/ui-message-return
Closed

[ai] Return UIMessage[] from DurableAgent stream call#760
VaguelySerious wants to merge 1 commit intomainfrom
peter/ui-message-return

Conversation

@VaguelySerious
Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: Peter Wielander <mittgfu@gmail.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Jan 9, 2026

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

Project Deployment Review Updated (UTC)
example-nextjs-workflow-turbopack Error Error Jan 9, 2026 8:01pm
example-nextjs-workflow-webpack Error Error Jan 9, 2026 8:01pm
example-workflow Ready Ready Preview, Comment Jan 9, 2026 8:01pm
workbench-astro-workflow Ready Ready Preview, Comment Jan 9, 2026 8:01pm
workbench-express-workflow Ready Ready Preview, Comment Jan 9, 2026 8:01pm
workbench-fastify-workflow Ready Ready Preview, Comment Jan 9, 2026 8:01pm
workbench-hono-workflow Ready Ready Preview, Comment Jan 9, 2026 8:01pm
workbench-nitro-workflow Ready Ready Preview, Comment Jan 9, 2026 8:01pm
workbench-nuxt-workflow Ready Ready Preview, Comment Jan 9, 2026 8:01pm
workbench-sveltekit-workflow Error Error Jan 9, 2026 8:01pm
workbench-vite-workflow Ready Ready Preview, Comment Jan 9, 2026 8:01pm
workflow-docs Error Error Jan 9, 2026 8:01pm

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 9, 2026

⚠️ No Changeset found

Latest commit: bf748ba

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 9, 2026

🧪 E2E Test Results

All tests passed

Summary

Passed Failed Skipped Total
✅ ▲ Vercel Production 264 0 8 272
Total 264 0 8 272

Details by Category

✅ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 33 0 1
✅ example 33 0 1
✅ express 33 0 1
✅ fastify 33 0 1
✅ hono 33 0 1
✅ nitro 33 0 1
✅ nuxt 33 0 1
✅ vite 33 0 1

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: failure
  • Local Dev: failure
  • Local Prod: failure
  • Local Postgres: failure
  • Windows: failure

Check the workflow run for details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 9, 2026

No benchmark result files found in benchmark-results

Comment on lines +249 to +254
if (part.type === 'text' && part.text) {
this.currentMessage.parts.push({
type: 'text',
text: part.text,
});
} else if (part.type === 'reasoning' && part.text) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (part.type === 'text' && part.text) {
this.currentMessage.parts.push({
type: 'text',
text: part.text,
});
} else if (part.type === 'reasoning' && part.text) {
if (part.type === 'text' && part.text !== undefined && part.text !== null) {
this.currentMessage.parts.push({
type: 'text',
text: part.text,
});
} else if (part.type === 'reasoning' && part.text !== undefined && part.text !== null) {

Empty text and reasoning parts are silently dropped due to falsy check, potentially losing valid empty message content

Fix on Vercel

} as any);
}
break;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The 'source-url' and 'source-document' cases don't call finalizeCurrentPart() before adding the source, causing pending text/reasoning/tool-invocation parts to be skipped or added out of order

Fix on Vercel

Comment on lines +51 to +57
// Process the chunk to accumulate messages
this.processChunk(chunk);

// Forward to the inner writable
const writer = this.innerWritable.getWriter();
try {
await writer.write(chunk);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Process the chunk to accumulate messages
this.processChunk(chunk);
// Forward to the inner writable
const writer = this.innerWritable.getWriter();
try {
await writer.write(chunk);
// Forward to the inner writable first, then process
const writer = this.innerWritable.getWriter();
try {
await writer.write(chunk);
// Only process the chunk if the write succeeded
this.processChunk(chunk);

UIMessageAccumulator processes chunks before verifying they can be written to the inner stream, causing accumulated messages to include chunks that failed to write.

Fix on Vercel

@VaguelySerious
Copy link
Copy Markdown
Member Author

Closed in favor of #768

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