Skip to content

[Bug]: TUI: streaming text still lost during tool calls despite #10704 fix (2026.3.2) #36957

Closed

Description

@Datyedyeguy

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

  1. Start openclaw gui (TUI mode)
  2. Send a message that will trigger the agent to respond with text, then execute one or more tool calls, then continue with more text
  3. Observe: the pre-tool-call text appears briefly, then vanishes when the tool call begins
  4. 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.

Image

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 recover

Impact 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:18789 exhibits 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

Activity

  1. added
    bug
    on Mar 6, 2026
  2. added
    bug:behavior
    on Mar 6, 2026
  3. vignesh07 commented on Mar 6, 2026

    @vignesh07
    Member

    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:

    • non-prefix post-tool segmented streaming preserving pre-tool text
    • throttled segmented update flushing merged text before final

    Thanks @Datyedyeguy for the detailed repro and screenshots.

  4. vignesh07 commented on Mar 6, 2026

    @vignesh07
    Member

    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:

    • non-prefix post-tool segmented streaming preserving pre-tool text
    • throttled segmented update flushing merged text before final

    Thanks @Datyedyeguy for the detailed repro and screenshots.

  5. locked as resolved and limited conversation to collaborators on Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbug:behavior

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions