[Bug] JSON Parse Error with Zhipu GLM-4.7: Stream chunks are concatenated incorrectly
Description
Description: I encountered a JSON Parse Error when using the Zhipu GLM-4.7 model. It seems like the stream parser fails to handle the boundary between two data chunks correctly, leading to invalid JSON.
The Error: The error message shows that the end of the previous message and the start of the next data: chunk are stuck together without proper separation.
Error Log / Evidence:
AI_JSONParseError: JSON parsing failed: Text: ... "role":"assistant"data: {"id": ... Error message: JSON Parse error: Expected '}'
As seen in the log, the string "role":"assistant" is immediately followed by data:, missing the closing brace } and likely a newline character.
Environment:
Model: Zhipu GLM-4.7 (configured via zhipu/glm-4.7)
Plugin: OMO / OpenCode
Plugins
Z.ai/GLM-4.7 ; OhMyOpencode
OpenCode version
1.0.152
Steps to reproduce
- Configure the OMO plugin to use Zhipu GLM-4.7 as the default model for the 'Sisyphus' agent (or set it in the model configuration).
- Open the OMO interface and select the 'Sisyphus' mode.
- Input a task to trigger the agent (e.g., "Analyze this project" or "Write a simple snake game").
- Wait for the model to start streaming the response.
- The
AI_JSONParseErroroccurs immediately when the model returns a response, interrupting the stream.
Screenshot and/or share link
No response
Operating System
window11
Terminal
WindowsTerminal in Trae