Skip to content

[Studio][fix] Preserve SSE framing for AI chat#438

Open
btlqql wants to merge 1 commit into
apache:rocketmq-studiofrom
btlqql:agent/studio-sse-stream-framing
Open

[Studio][fix] Preserve SSE framing for AI chat#438
btlqql wants to merge 1 commit into
apache:rocketmq-studiofrom
btlqql:agent/studio-sse-stream-framing

Conversation

@btlqql

@btlqql btlqql commented Jul 16, 2026

Copy link
Copy Markdown

Summary

  • buffer AI chat stream bytes until a complete SSE event is available
  • handle fragmented, coalesced, CRLF, multiline, raw, and end-of-stream event data
  • accept both the existing content payload and the server stub's text payload
  • add focused regression coverage for SSE framing and the [DONE] sentinel

Root cause

chatStream split every network chunk on newlines and parsed it immediately. ReadableStream chunks do not preserve SSE event boundaries, so JSON split between chunks was treated as malformed raw text. The client also ignored the text field emitted by LlmGatewayStub.

Impact

AI responses are no longer lost or corrupted when an event is split or combined by the network, and the bundled backend stub now matches the frontend stream consumer.

Validation

  • cd web && npm test — 9 tests passed
  • cd web && npm run build — passed
  • cd web && npm run lint — 0 errors; 3 pre-existing warnings in unrelated files
  • pre-commit ESLint and Prettier checks — passed

Fixes #437

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