-
Notifications
You must be signed in to change notification settings - Fork 158
[ai] Fix collectUiMessages option by accumulating chunks in a separate step call #784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: peter/fix-step-serialization
Are you sure you want to change the base?
[ai] Fix collectUiMessages option by accumulating chunks in a separate step call #784
Conversation
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
🦋 Changeset detectedLatest commit: 171d1b2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express | Nitro workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) | Express Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) | Express Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) | Express Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro | Express SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests▲ Vercel Production (11 failed)astro (1 failed):
example (1 failed):
express (1 failed):
fastify (1 failed):
hono (1 failed):
nextjs-turbopack (1 failed):
nextjs-webpack (1 failed):
nitro (1 failed):
nuxt (1 failed):
sveltekit (1 failed):
vite (1 failed):
💻 Local Development (10 failed)astro-stable (1 failed):
express-stable (1 failed):
fastify-stable (1 failed):
hono-stable (1 failed):
nextjs-turbopack-stable (1 failed):
nextjs-webpack-stable (1 failed):
nitro-stable (1 failed):
nuxt-stable (1 failed):
sveltekit-stable (1 failed):
vite-stable (1 failed):
📦 Local Production (10 failed)astro-stable (1 failed):
express-stable (1 failed):
fastify-stable (1 failed):
hono-stable (1 failed):
nextjs-turbopack-stable (1 failed):
nextjs-webpack-stable (1 failed):
nitro-stable (1 failed):
nuxt-stable (1 failed):
sveltekit-stable (1 failed):
vite-stable (1 failed):
🐘 Local Postgres (10 failed)astro-stable (1 failed):
express-stable (1 failed):
fastify-stable (1 failed):
hono-stable (1 failed):
nextjs-turbopack-stable (1 failed):
nextjs-webpack-stable (1 failed):
nitro-stable (1 failed):
nuxt-stable (1 failed):
sveltekit-stable (1 failed):
vite-stable (1 failed):
🪟 Windows (1 failed)nextjs-turbopack (1 failed):
🌍 Community Worlds (24 failed)mongodb (2 failed):
redis (2 failed):
starter (18 failed):
turso (2 failed):
Details by Category❌ ▲ Vercel Production
❌ 💻 Local Development
❌ 📦 Local Production
❌ 🐘 Local Postgres
❌ 🪟 Windows
❌ 🌍 Community Worlds
❌ Some E2E test jobs failed:
Check the workflow run for details. |
readUIMessageStream
readUIMessageStreamSigned-off-by: Peter Wielander <mittgfu@gmail.com>
…ent-collectUiMessages
I, Peter Wielander <mittgfu@gmail.com>, hereby add my Signed-off-by to this commit: 0e8fe8c Signed-off-by: Peter Wielander <mittgfu@gmail.com>
…e made in sequence, causing incomplete UI state collection in DurableAgent. Co-authored-by: VaguelySerious <mittgfu@gmail.com>
This is a refactor of #768 which moves the accumulation logic to a step. The test harness I was using to test #768 didn't correctly account for the workflow transformation, so
collectUiMessagesdidn't actually work as intended before (also reported in issue #739).This PR moves the final accumulation call to a
"use step"at the end of theagent.streamcall. The actual logic still uses AI SDK'sreadUIMessageStreaminternally, just like before.I alternatively considered pre-creating a stream in a setup step, then double piping to that stream, before passing it to the final step that can call
readUIMessageStreamon it. In a non-workflow world, this would result in a performance improvement (native stream use), but since we are awaiting step boundaries anyway, it would not help in this case, and it would make the content less observable.