Description
When the bot receives an @mention inside a Teams channel thread, the reply is posted as a new top-level channel message instead of within the same thread.
The Bot Framework inbound activity provides the thread root message ID, and the inbound handler in message-handler.ts correctly saves it as replyToId on the StoredConversationReference. However, by the time the reply is sent, replyStyle resolves to "top-level", so the stored replyToId is never used to route the reply into the thread.
The messenger infrastructure for thread replies already exists (buildActivity handles threadRootId, sendProactively constructs the ;messageid= conversation ID). The gap is in the policy resolution and the send path.
Root Cause
Two independent issues:
-
Reply policy defaults replyStyle to "top-level" when requireMention: false -- resolveMSTeamsReplyPolicy() in policy.ts defaults replyStyle based on the requireMention setting. When requireMention is false, replyStyle defaults to "top-level" regardless of whether the inbound message came from a thread. Setting replyStyle: "thread" explicitly in config does not fully resolve the issue either.
-
send.ts hardcodes replyStyle: "top-level" -- The proactive send path in send.ts (~line 328) hardcodes replyStyle: "top-level" when calling sendMSTeamsMessages, ignoring thread context entirely. This affects messages sent via the message tool.
Steps to Reproduce
- Configure msteams channel with
requireMention: false
- @mention the bot in a Teams channel -- bot responds (as a top-level post)
- @mention the bot again inside the thread of any channel message
- Expected: Bot replies within the same thread
- Actual: Bot replies as a new top-level channel post
Confirmed via debug logging:
- Inbound:
conversationRef.replyToId=1774246097310 (correct thread root ID)
- Outbound:
replyStyle=top-level, threadRootId=undefined (thread context lost)
Related Issues
Version
Tested on OpenClaw 2026.3.13, @openclaw/msteams extension.
Description
When the bot receives an @mention inside a Teams channel thread, the reply is posted as a new top-level channel message instead of within the same thread.
The Bot Framework inbound activity provides the thread root message ID, and the inbound handler in
message-handler.tscorrectly saves it asreplyToIdon theStoredConversationReference. However, by the time the reply is sent,replyStyleresolves to"top-level", so the storedreplyToIdis never used to route the reply into the thread.The messenger infrastructure for thread replies already exists (
buildActivityhandlesthreadRootId,sendProactivelyconstructs the;messageid=conversation ID). The gap is in the policy resolution and the send path.Root Cause
Two independent issues:
Reply policy defaults
replyStyleto"top-level"whenrequireMention: false--resolveMSTeamsReplyPolicy()inpolicy.tsdefaultsreplyStylebased on therequireMentionsetting. WhenrequireMentionisfalse,replyStyledefaults to"top-level"regardless of whether the inbound message came from a thread. SettingreplyStyle: "thread"explicitly in config does not fully resolve the issue either.send.tshardcodesreplyStyle: "top-level"-- The proactive send path insend.ts(~line 328) hardcodesreplyStyle: "top-level"when callingsendMSTeamsMessages, ignoring thread context entirely. This affects messages sent via the message tool.Steps to Reproduce
requireMention: falseConfirmed via debug logging:
conversationRef.replyToId=1774246097310(correct thread root ID)replyStyle=top-level,threadRootId=undefined(thread context lost)Related Issues
replyToIdunreliable for implicit mention detection (related but distinct: that's about detecting thread replies, this is about replying into threads)Version
Tested on OpenClaw 2026.3.13,
@openclaw/msteamsextension.