-
-
Notifications
You must be signed in to change notification settings - Fork 69.4k
Bug: deltaBuffer missing cross-turn separator causes text concatenation in streaming UI #35308
Description
Summary
When blockStreaming is enabled, the agent runner's deltaBuffer does not insert any separator between successive API turns. This causes the text from separate tool-call cycles to be concatenated together in the streaming UI, producing garbled output (e.g. pre-tool text runs directly into post-tool text without a newline or space).
After a page refresh, the full history renders correctly via the history endpoint — confirming the data is intact and this is purely a streaming display bug.
Steps to reproduce
- Enable
blockStreaming(agents.defaults.blockStreamingDefault = "on") - Ask an agent a question that triggers a tool call mid-response
- Observe the streaming output in the webchat or any WebSocket-connected UI
- The text before the tool call and text after it are joined with no separator
Expected behaviour
Each API turn's text block should be separated by at least \n\n (or equivalent) in the deltaBuffer stream, matching how the completed history renders.
Actual behaviour
Streaming output: "Now update MEMORY.md with durableNO Fresh session, fully up to speed..."
The string durable is the end of the pre-tool text and NO is the start of the post-tool text — joined with no separator.
Root cause (located)
In the compiled agent runner (around the deltaBuffer accumulator), there is no crossTurnPrefix or separator injected when moving between tool-call turns. A workaround patch is to prepend \n\n at each cross-turn boundary.
Workaround
Disable block streaming:
openclaw config set agents.defaults.blockStreamingDefault off
This avoids the issue but loses the benefits of block streaming.
Environment
- OpenClaw 2026.2.21-2 (also observed on prior versions)
- macOS (Darwin arm64)
- All agent types affected