Skip to content

fix(genui): swallow the closing stream_done event instead of materializing it - #34

Merged
AimTune merged 1 commit into
mainfrom
fix/genui-stream-done-phantom-bubble
Jul 28, 2026
Merged

fix(genui): swallow the closing stream_done event instead of materializing it#34
AimTune merged 1 commit into
mainfrom
fix/genui-stream-done-phantom-bubble

Conversation

@AimTune

@AimTune AimTune commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Problem

A connector''s terminating stream_done event (mekik PROTOCOL.md 4.1) is stream lifecycle, not content, but ChatEngine._handleGenUIChunk treated it like any other chunk:

  • text-only stream — the event has no genui host to live in, so it opened a phantom empty bubble after the answer
  • genui stream — the closing event was appended to the message''s chunks list

Fix

_handleGenUIChunk now finishes the stream and returns early when it sees type: event / name: stream_done. genui_stream_completed still fires and streamingComplete is still set.

Also makes AIChunkEvent.payload optional. schemas/genui/ai-chunk.schema.json already lists only type / name / id as required, so the TS type was stricter than the contract — signal-only events like stream_done carry no payload. Both streaming.md doc trees updated to match.

Verification

  • pnpm --filter @chativa/core exec tsc --noEmit clean
  • pnpm --filter @chativa/core test — 296 passed (2 new regression tests, one per stream shape)

🤖 Generated with Claude Code

…izing it

A connector's terminating `stream_done` event (mekik PROTOCOL.md 4.1) is stream
lifecycle, not content. ChatEngine treated it like any other chunk, so a
text-only stream got a phantom empty genui bubble opened for an event that has
nowhere to live, and a genui stream got the closing event appended to its chunk
list. _handleGenUIChunk now finishes the stream and returns early.

Also makes AIChunkEvent.payload optional, matching
schemas/genui/ai-chunk.schema.json, which already lists only type/name/id as
required. Signal-only events such as stream_done carry no payload.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@AimTune
AimTune merged commit cb0549a into main Jul 28, 2026
1 check passed
@AimTune
AimTune deleted the fix/genui-stream-done-phantom-bubble branch July 28, 2026 21:50
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