Skip to content

[Bug]: MS Teams channel thread replies post as top-level messages instead of in the thread #52954

@gumclaw

Description

@gumclaw

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:

  1. 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.

  2. 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

  1. Configure msteams channel with requireMention: false
  2. @mention the bot in a Teams channel -- bot responds (as a top-level post)
  3. @mention the bot again inside the thread of any channel message
  4. Expected: Bot replies within the same thread
  5. 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.

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