Skip to content

fix(studio): serialize SSE error events as valid JSON - #219

Merged
yuluo-yx merged 1 commit into
agentic-ai-java:mainfrom
Duansg:fix/studio-sse-error-json
Oct 23, 2026
Merged

yuluo-yx merged 1 commit into
agentic-ai-java:mainfrom
Duansg:fix/studio-sse-error-json

Conversation

@Duansg

@Duansg Duansg commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Describe what this PR does / why we need it

Contributing to ARGI: Studio SSE error events are now always valid JSON, and the UI no longer silently drops malformed error events.

Does this pull request fix one issue?

Fixes #192

Describe how you did it

  • Agent and Graph controllers serialize a shared StreamErrorResponse with the existing ObjectMapper, with a constant fallback if serialization fails. Event name and fields (error, errorType, errorMessage) are unchanged.
  • argi-api.ts uses one SSE reader for both streams: an unparsable event: error now fails the stream, while malformed normal data lines are still skipped. It also handles CRLF, chunk boundaries and a trailing event without newline.

Describe how to verify it

  • ./mvnw -pl :argi-studio -am test (new StudioStreamErrorEventTest: quotes, backslashes, Windows paths, tab, CR, LF, Unicode, null message, serializer failure).
  • pnpm test in argi-studio/agent-chat-ui (15 tests, including split-chunk and malformed error event cases).

Special notes for reviews

Bundled static assets under META-INF/resources/chatui are not rebuilt in this PR, consistent with previous argi-api.ts changes. No browser end-to-end run.

@yuluo-yx yuluo-yx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the SSE serialization and shared reader changes with the regression tests. The failed format job was a Maven download HTTP 429, not a formatting finding.

@yuluo-yx
yuluo-yx merged commit 2ec1a43 into agentic-ai-java:main Oct 23, 2026
6 of 7 checks passed
@Duansg
Duansg deleted the fix/studio-sse-error-json branch October 23, 2026 01:35
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.

[BUG][OPT-08] 修复 Studio SSE 错误 JSON 转义及前端静默丢弃

2 participants