Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

StreamProcessor drops TEXT_MESSAGE_CHUNK events without a warning

Aperta
#1,531 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@AlemTuzlak ci sta già lavorando.

Dal 27/9/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

waiting-on: maintainer
TanStack AI version

v0.61.0

Framework/Library version

React v19.2.0

Describe the bug and the steps to reproduce it

StreamProcessor has no handler for TEXT_MESSAGE_CHUNK. The event reaches
the default branch of processChunk and the processor drops it. There is no
warning.

AG-UI defines TEXT_MESSAGE_CHUNK as a short form of the
TEXT_MESSAGE_START / TEXT_MESSAGE_CONTENT / TEXT_MESSAGE_END triad. A
server can send one chunk event instead of three events. The AG-UI spec gives
the expansion job to the client stream transformer.

Two parts of this repository say that the event is supported:

  • packages/ai/src/types.ts declares TextMessageChunkEvent and puts it in
    the AGUIEvent union. That union is the exported StreamChunk type.
  • packages/ai/src/utilities/spec-event-keys.ts gives the event an allowlist
    entry, so stripToSpec keeps messageId, role, delta, and metadata
    at the top level.

The runtime does not match this. TOOL_CALL_CHUNK and
REASONING_MESSAGE_CHUNK have the same problem.

Steps to reproduce

live:
https://codesandbox.io/p/sandbox/hvf3mx

Open the sandbox. It needs no API key and makes no network calls. The AG-UI
events are constants in src/App.js.

  1. Build a StreamProcessor.
  2. Send RUN_STARTED, then one TEXT_MESSAGE_CHUNK with a messageId, a
    delta, and a metadata.error, then RUN_ERROR.
  3. Read processor.getMessages().
  4. Do the same again with the explicit triad in place of the chunk event.

Result

The chunk event loses three things that the triad keeps:

The server sent this, and the client TEXT_MESSAGE_CHUNK START / CONTENT / END
shows the text "the run failed" lost yes
keeps the message id "msg-1" lost yes
keeps metadata.error lost yes

The assistant message is not absent. It is empty, and it has a new id:

[{ "id": "msg-1790507900666-2mxf4p", "role": "assistant", "parts": [] }]

RUN_ERROR created that message. The id msg-1 from the server is gone, so a
later event that uses msg-1 cannot find the message.

Expected result
Both forms describe the same turn. Both must produce the same message.

Notes
MESSAGES_SNAPSHOT is a plain messages[], so a reload of a saved thread
shows the correct text. The fault is visible only during a live run. A unit
test that sends the triad cannot find this fault.

processChunk already has the three handlers that an expansion needs. A
case per chunk event can call them, hold the open message id, and close the
message when the id changes or when finalizeStream runs.

Related: #1465 tried this and closed without a merge. #1460 added the AG-UI 1.0
types and left the runtime out of scope.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://codesandbox.io/p/sandbox/hvf3mx

Screenshots or Videos (Optional)
Image
Do you intend to try to help solve this bug with your own PR?

None

Terms & Code of Conduct
  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Lingua principale
TypeScript
Stelle
3.1k
Fork
340
Merge medio
2g 10h
PR unite (30g)
174

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TanStack/ai

Tutte le issue di TanStack/ai

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.