Skip to content

TUI: streaming message replaced by concurrent update #10704

Closed

Description

@axschr73

Description

When a tool call (like file edit) completes while a message is still streaming to the TUI, the in-flight response is replaced by a subsequent message instead of being allowed to complete.

Steps to Reproduce

  1. Generate a longer response that will take a few seconds to stream
  2. While streaming is happening, execute a tool call (e.g., edit to update a file)
  3. Once the tool completes, a new message is sent to the TUI

Expected: The streaming message continues and completes; subsequent messages queue or appear after
Actual: The incomplete streaming message is dropped and replaced by the new message, losing the partial content

Example

I generated a recap message (visible in TUI), then called edit to update MEMORY.md. While my response was mid-stream, the edit completed and a new message was sent. The TUI dropped the original streaming response and displayed only the new one.

Possible Root Cause

The TUI likely doesn't handle concurrent message updates gracefully. When a new message arrives while a previous one is still streaming, it should queue or merge, not replace.

Impact

  • Confusing UX: users see text appear, then suddenly vanish
  • Loss of information: partial responses are discarded
  • Looks like a crash or error when it's not

Activity

  1. jayclawson commented on Feb 10, 2026

    @jayclawson

    Reproduction Case: Text Before Tool Calls Disappears

    Environment:

    • OpenClaw 2026.2.6-3 (85ed6c7)
    • Model: Claude Sonnet 4.5
    • Interface: TUI (webchat)

    Steps to Reproduce:

    1. Send a message that triggers tool calls with text BEFORE the tool calls
    2. Watch the response stream in
    3. When tool call completes, observe the pre-tool text vanish

    Expected: All text (pre-tool + post-tool) should remain visible

    Actual: Only post-tool text remains after tool call completes

    Examples:

    • Text like "Let me check that for you" appears, then disappears
    • Explanatory text before tool execution vanishes
    • Only text AFTER tool results stays visible

    Workarounds Tried:

    • Ctrl+O toggle: Does NOT restore missing text
    • Scrolling: Text is gone from history

    Consistency: Happens with ALL tool calls (web_search, exec, sessions_history, Read, etc.)

    This appears to match the "streaming message replaced by concurrent update" description from the original issue.

  2. added
    bug
    tui
    on Feb 10, 2026
  3. vignesh07 commented on Feb 15, 2026

    @vignesh07
    Member

    Thanks for the report — revalidated and fixed on main.

    Merged:

    • 61228639c fix (tui): preserve active stream during concurrent run finals
    • b607c41a5 chore (changelog): note TUI concurrent stream hardening

    Root cause:

    • Non-local chat.final events for a different run could clear activeChatRunId and trigger loadHistory() while another run was still streaming.
    • loadHistory() clears the chat log, which caused the in-flight partial stream to disappear/appear replaced.

    Fix:

    • Keep the active run pinned unless the incoming event matches it.
    • Skip history reload for non-local runs when another run is actively streaming.
    • Preserve status transitions for the actual active run only.

    Regression coverage:

    • Added test: src/tui/tui-event-handlers.test.ts (does not reload history or clear active run when another run final arrives mid-stream).
    • Validated with: pnpm vitest src/tui/tui-event-handlers.test.ts.

    Closing as fixed on main.

  4. locked as resolved and limited conversation to collaborators on Mar 4, 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

    bugtui

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions