Repository navigation
Description
Bug type
Behavior bug (incorrect output/state without crash)
Summary
The fix for #10704 (preserve in-flight streaming replies when a different run finalizes concurrently) shipped in 2026.3.2, but the issue still reproduces. When the agent sends text followed by tool calls (e.g., exec, read, edit), the initial streamed text disappears and only the post-tool-call portion of the response is visible in the TUI.
Steps to reproduce
- Start
openclaw gui(TUI mode) - Send a message that will trigger the agent to respond with text, then execute one or more tool calls, then continue with more text
- Observe: the pre-tool-call text appears briefly, then vanishes when the tool call begins
- Only the text after the tool calls is visible in the final rendered message
Expected behavior
The full response (pre-tool text + tool call blocks + post-tool text) should all remain visible during streaming and after completion, in both TUI and web GUI.
Actual behavior
Pre-tool-call streamed text is lost during streaming in both the TUI and web GUI. The web GUI recovers on page refresh; the TUI does not — the text stays gone for the session.
OpenClaw version
2026.3.2 (85377a2)
Operating system
Ubuntu 24.04 (WSL2) on Windows
Install method
npm install -g openclaw@latest(user prefix~/.npm-global`)
Logs, screenshots, and evidence
Side-by-side comparison — web GUI (left) vs TUI (right) showing the same response:
- **Web GUI** shows: initial text ("Good thinking. Let me send a response...") → tool call blocks (3x `exec`) → final text ("Here's a world clock check...") *after page refresh*. During live streaming, the web GUI also loses the pre-tool text.
- **TUI** shows: only the final text ("Here's a world clock check...") — all pre-tool-call text is missing and does not recoverImpact and severity
Severity: Medium — no data loss, but degrades usability
- Information loss in TUI: Users miss context, explanations, and reasoning that the agent provided before tool calls. This is especially problematic for longer responses where the agent explains what it's about to do, then does it.
- Confusing UX: Text appears briefly then vanishes, making it look like a bug or crash. Users end up asking "was a message missed?" and switching to the web GUI to see the full response.
- Workaround exists: Web GUI at
localhost:18789exhibits the same issue during streaming, but corrects itself on page refresh. The TUI does not recover — the lost text stays gone for the session. - Frequency: Reproduces on nearly every response that includes tool calls — very common in agent workflows.
Additional information
No response
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
vignesh07 commentedon Mar 6, 2026
Fixed on main in d326861.
Root cause: gateway chat buffering overwrote prior streamed text when providers emitted a new assistant segment after tool calls as a non-prefix snapshot. The fix now merges assistant segments into each run's chat buffer (with overlap-safe suffix handling) instead of replacing the buffer on non-prefix updates, so pre-tool and post-tool text are both preserved in live chat deltas and final payloads.
Regression coverage added in for:
Thanks @Datyedyeguy for the detailed repro and screenshots.
vignesh07 commentedon Mar 6, 2026
Follow-up (corrected formatting): fixed on main in d326861.
Root cause: gateway chat buffering overwrote prior streamed text when providers emitted a new assistant segment after tool calls as a non-prefix snapshot. The fix now merges assistant delta segments into each run chat buffer (with overlap-safe suffix handling) instead of replacing the buffer on non-prefix updates, so pre-tool and post-tool text are both preserved in live chat deltas and final payloads.
Regression coverage added in src/gateway/server-chat.agent-events.test.ts for:
Thanks @Datyedyeguy for the detailed repro and screenshots.