Skip to content

Concurrent message handling per session (async agent turns) #56880

Description

@darealgege

Problem

Currently, when an agent is processing a message on Discord, all subsequent messages from the same user/channel are queued and wait until the current turn completes before processing begins. This creates a significant UX bottleneck:

Scenario:

  1. User asks a complex question (e.g., debugging a config issue — many tool calls, 2+ minutes)
  2. While agent is working, user sends a quick follow-up ("what time is it?" / "yes" / "never mind")
  3. The quick message sits in queue until the long-running turn finishes
  4. User waits 2+ minutes for what should be a 1-second response

This is especially painful on Discord where conversations are naturally fast-paced and interleaved.

Current Behavior

  • Messages are processed sequentially per session (FIFO queue)
  • A long-running agent turn blocks all subsequent messages
  • Queued messages are batched and delivered after the current turn completes
  • The user sees "Bütyök is thinking..." with no way to get a quick response

Desired Behavior

Allow concurrent message handling within a session, so that:

  1. A new incoming message can spawn a parallel agent turn while another is still running
  2. Short/simple messages get fast responses even when a complex task is in progress
  3. The agent maintains context awareness across concurrent turns (knows what's in-flight)
  4. Optionally, the agent can decide to interrupt/deprioritize the current task if a new message is more urgent

Possible Implementation Ideas

  • Parallel turn slots per session (configurable maxConcurrentTurns: 2-3)
  • Priority-based routing: quick messages (short text, no tool calls expected) get a fast lane
  • Turn interruption: new messages can signal the agent to pause/checkpoint the current task
  • Independent sub-turns: each message gets its own turn context but shares session memory

Considerations

  • Context coherence: concurrent turns need to be aware of each other to avoid conflicts
  • Tool execution safety: two turns writing the same file simultaneously could cause issues
  • Rate limits: more concurrent turns = more API calls
  • Discord threading: could leverage Discord threads as a natural parallelism boundary

Use Cases

  1. User sends a complex task, then immediately asks a simple question → both get timely responses
  2. User sends "cancel" or "never mind" → agent can interrupt the current long-running task
  3. Multiple users in a group chat → messages from different users don't block each other

Environment

  • OpenClaw version: 2026.3.28
  • Channel: Discord (but applies to all chat channels)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions