-
-
Notifications
You must be signed in to change notification settings - Fork 55.4k
Closed as not planned
Closed as not planned
Copy link
Labels
bugSomething isn't workingSomething isn't workingstaleMarked as stale due to inactivityMarked as stale due to inactivity
Description
[Bug/Feature Request] Message queue blocks user messages during long-running tasks
1. Problem Description
When the Agent is processing a message (such as heartbeat checks or system events), new user messages are queued and experience significant delays. This creates a poor user experience where user interactions are blocked by background system operations.
Real-world case: User messages experienced an 11-minute delay before being processed due to system events triggered by WhatsApp gateway disconnection.
2. Steps to Reproduce
- Agent is performing heartbeat checks
- WhatsApp gateway disconnects simultaneously, triggering system events
- User sends a message via Telegram
- Message gets queued until previous processing completes
- User experiences significant delay in receiving response
3. Root Cause Analysis
Serial Message Processing
- Messages are processed sequentially - one message must complete before the next can be processed
- No priority mechanism exists - user messages and system events are treated equally
- No timeout interruption mechanism - even if a task gets stuck, it cannot be interrupted by new messages
Current Architecture Limitations
- Single-threaded message handling creates bottlenecks
- System events (like disconnection notifications) can block user-facing operations
- No differentiation between time-sensitive user messages and background system tasks
4. Suggested Solutions
Priority Queue Implementation
- Priority levels: Direct user messages > System events > Heartbeat checks
- User interactions should always have the highest priority
Asynchronous System Event Handling
- System events (like disconnection notifications) should not block user messages
- Move non-critical system events to background processing
Timeout Mechanism
- Implement timeout for individual message processing (e.g., X seconds)
- Allow long-running tasks to be interrupted or moved to background
- Provide feedback to users when tasks are taking longer than expected
Parallel Processing
- Enable concurrent processing of lightweight messages
- Implement worker pools for different message types
- At minimum, allow multiple user messages to be processed simultaneously
5. Environment Information
- OpenClaw version: 2026.2.1
- OS: WSL2 Ubuntu on Windows
- Channels: Telegram + WhatsApp
- Impact: Critical - affects user experience and system responsiveness
6. Additional Context
This issue significantly impacts user experience, especially in scenarios where:
- Multiple channels are active simultaneously
- System events occur during peak user activity
- Background maintenance tasks overlap with user interactions
The current behavior makes the system feel unresponsive and may cause users to believe the agent is not functioning correctly.
7. Acceptance Criteria
- User messages are processed within 5 seconds regardless of background tasks
- System events do not block user message processing
- Priority queue correctly prioritizes user messages over system events
- Timeout mechanism prevents indefinite blocking
- Parallel processing handles concurrent user messages efficiently
- System provides feedback when tasks are running longer than expected
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingstaleMarked as stale due to inactivityMarked as stale due to inactivity