Problem
When receiving a DM in Mattermost, bot replies go to a new Thread instead of the main DM channel.
Expected Behavior
- DM main list message → reply should appear in main DM list
- DM Thread message → reply should appear in that Thread
Current Behavior
All DM replies go to a new Thread, breaking the conversation flow.
Environment
- OpenClaw with Mattermost plugin
Technical Details
The issue is in the resolveMattermostReplyRootId and resolveMattermostEffectiveReplyToId functions in auth-profiles-*.js.
Root Cause: The threadRootId check should be prioritized before kind === "direct" check. Currently for DM Thread messages, threadRootId is set but the logic causes replies to go to a new Thread.
Suggested Fix: Adjust the check order in both functions - threadRootId should be checked first, then kind === "direct" applies only when threadRootId is empty.
Problem
When receiving a DM in Mattermost, bot replies go to a new Thread instead of the main DM channel.
Expected Behavior
Current Behavior
All DM replies go to a new Thread, breaking the conversation flow.
Environment
Technical Details
The issue is in the
resolveMattermostReplyRootIdandresolveMattermostEffectiveReplyToIdfunctions inauth-profiles-*.js.Root Cause: The
threadRootIdcheck should be prioritized beforekind === "direct"check. Currently for DM Thread messages,threadRootIdis set but the logic causes replies to go to a new Thread.Suggested Fix: Adjust the check order in both functions -
threadRootIdshould be checked first, thenkind === "direct"applies only whenthreadRootIdis empty.