Skip to content

Bug: User messages not displayed immediately in Control UI (optimistic update lost after history reload) #67961

@njxiaohan

Description

@njxiaohan

Bug: User messages not displayed immediately in Control UI

Description:
When a user sends a message in the Control UI (webchat), the message is optimistically added to the local chatMessages state. However, the subsequent WebSocket event triggers loadChatHistory() which replaces the entire local chatMessages with the server response. Since the context has been compacted, the user's message appears as a metadata block instead of the original text.

Steps to reproduce:

  1. Open Control UI webchat
  2. Type and send a message
  3. Message does not appear immediately in the chat window
  4. After AI responds, the user's message appears as compressed metadata

Expected behavior:
User's message should appear immediately in the chat window (optimistic update) without waiting for the AI response.

File: ui/src/ui/controllers/chat.ts
Function: loadChatHistory() and message sending flow

Suggested fix:
When reloading chat history after sending a message, preserve locally pending/unconfirmed user messages rather than replacing them entirely with the server response. One approach would be to track locally sent messages (by their client-generated ID or content hash) and merge them with the server history instead of replacing.

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