Skip to content

Mattermost: Channel-bound sessions cannot thread replies (dispatcher routing bug) #40924

@hnykda

Description

@hnykda

Root Cause Found: Dispatcher Session Duplication

When a message arrives with thread context (e.g., replying in a thread), OpenClaw's message dispatcher is routing to both:

  1. The channel-bound session (agent:main:mattermost:channel:148wkm4i7jgw5kwrsmkhqy319a)
  2. The thread-bound session (agent:main:main:thread:dzy3yige13g8br8a87b7aqz8xc)

Both sessions receive the message and both try to answer, causing:

  • One response in the thread (correct)
  • One response in the channel root (wrong — the "escape")

This manifests as duplication and confused routing, not just parameter passing.

Session Evidence

From sessions_list (Mon Mar 9, 12:27 GMT+1):

  • Channel-bound: agent:main:mattermost:channel:148wkm4i7jgw5kwrsmkhqy319a — opened Oct 8, still active, routing all messages to channel root
  • Thread-bound: agent:main:main:thread:dzy3yige13g8br8a87b7aqz8xc — created when thread started, routes to thread
  • Both registered as active and receiving messages simultaneously

What Needs to Change

The dispatcher's message routing logic should check: "Does this message have thread context?" If yes, only route to the thread-bound session. Do not activate the channel-bound session for messages that are explicitly in a thread.

Workaround (Applied Locally)

Deleted the stale channel-bound session, forcing all message traffic through the thread-bound session only. Temporary fix; the dispatcher logic is the real solution.

Related Issues (Same Root Cause)

This is part of a broader delivery pipeline bug affecting multiple channels. The replyTo/threadId parameters are being dropped or misnamed between the message tool and the channel send layer.

Cross-channel manifestations:

Common pattern: Parameters dropped at src/infra/outbound/message.ts → gateway API call junction.

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