Skip to content

Bug: deltaBuffer missing cross-turn separator causes text concatenation in streaming UI #35308

@matthewangus

Description

@matthewangus

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

  1. Enable blockStreaming (agents.defaults.blockStreamingDefault = "on")
  2. Ask an agent a question that triggers a tool call mid-response
  3. Observe the streaming output in the webchat or any WebSocket-connected UI
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions