-
-
Notifications
You must be signed in to change notification settings - Fork 69.3k
Mattermost: Channel-bound sessions cannot thread replies (dispatcher routing bug) #40924
Description
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:
- The channel-bound session (
agent:main:mattermost:channel:148wkm4i7jgw5kwrsmkhqy319a) - 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:
- Telegram: auto reply threading broken — replyToId not mapped to reply_to_message_id #17880 (Telegram) —
replyToIdset in pipeline but send layer readsreplyToMessageId(field mismatch) - [Bug]: Slack DM thread attachments posted outside thread when sent via message tool #38409 (Slack) — Message tool attachments escape threads; currentChannelId not populated for DM sessions
- [Bug]: Slack DM threading not working (replyToMode and reply_to tags ignored) #2411 (Slack) — DM threading broken; replyToMode/tags ignored
- [Feature]: Mattermost: support Slack-like “auto-thread replies” so each top-level message can become its own session/thread #29058 (Mattermost) — Feature request for auto-threading (related, not same bug)
- fix: sessions navigation, DM thread display, and DM thread delivery regression #3368 (Telegram) — DM threading regression, never merged (stale PR from 2023)
Common pattern: Parameters dropped at src/infra/outbound/message.ts → gateway API call junction.