OpenHands/OpenHands

Add message queue support for V1 conversations during WebSocket connection

Open

#12,279 建立於 2026年1月6日

在 GitHub 查看
 (6 留言) (0 反應) (0 負責人)Python (73,570 star) (9,299 fork)batch import
StaleUI/UXfrontendgood first issue

描述

Problem

V1 conversations do not queue user messages when the WebSocket connection is not yet established. A user is unable to submit a message before the WebSocket is fully connected (e.g., during runtime startup), instead of being queued and sent automatically once the connection is ready.

Background

PR #11687 added message queuing support for V0 conversations in the Socket.IO WebSocket provider. However, this functionality was never implemented for V1 conversations which use a native WebSocket via ConversationWebSocketProvider.

Current Behavior

The chat input is disabled when the WebSocket is not connected

Expected Behavior

Messages submitted before the WebSocket connection is established should be queued and automatically sent once the connection is ready, matching the V0 behavior.

Acceptance Criteria

[!IMPORTANT]The PR implementing this change should include sufficient test coverage. A test-driven development approach is preferred.

  • The V1 WebSocket provider should maintain a queue of pending messages when the connection is not yet open.
  • Queued messages should be automatically flushed in order when the WebSocket connection opens.
  • The pending message queue should be cleared when the conversation changes or is intentionally stopped.
  • Unit tests should be added to verify the message queuing and flushing behavior.

Relevant Files

frontend/src/contexts/conversation-websocket-context.tsx lines 722-741 contains the V1 sendMessage function that might be relevant for queuing support.frontend/src/context/ws-client-provider.tsx contains the V0 implementation with pendingEventsRef and flushPendingEvents that might serve as a reference. Feel free to implement a different strategy if you feel it would be better.frontend/src/hooks/use-send-message.ts is the unified hook that routes messages to V0 or V1 providers.frontend/tests/conversation-websocket-handler.test.tsx should be extended with tests for the new queuing behavior.

貢獻者指南