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:
- Open Control UI webchat
- Type and send a message
- Message does not appear immediately in the chat window
- 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.
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 localchatMessageswith 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:
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.tsFunction:
loadChatHistory()and message sending flowSuggested 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.