Loyal-Young opened a new issue, #5178:
URL: https://github.com/apache/rocketmq-dashboard/issues/5178

   ### Bug
   
   The AI run-stream parser accepts any syntactically valid JSON for an `event: 
agent` frame and then reads `.type` without checking the payload shape. A 
`data: null` frame throws a raw `TypeError` (`Cannot read properties of null`), 
while arrays and scalar JSON values are mislabeled as an unknown event type. 
These are malformed frames and should produce the existing structured 
`llm.stream.malformed_event` error without invoking the event handler.
   
   ### Reproduction
   
   Return `text/event-stream` with `event: agent\ndata: null\n\n` from the run 
stream endpoint. The new focused frontend test fails on current `master`, 
receiving a `TypeError` instead of `AiStreamError`. It also tests `[]`, `42`, 
and `"text"`.
   
   ### Expected behavior
   
   Any non-object agent payload should fail with `AiStreamError` code 
`llm.stream.malformed_event`, allowing the UI to use its normal stream-error 
handling.
   
   ### Proposed fix
   
   Validate that the parsed JSON is a non-null, non-array object before 
inspecting its event type; keep the existing unknown-type handling for object 
payloads.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to