Skip to content

[Bug]: MSTeams DM inbound messages appear duplicated in agent session context #67323

Description

@jlian

Description

When receiving DM messages via Microsoft Teams, each inbound message appears twice in the agent's session context. The duplicate shows up as a "Queued" message replayed after the agent finishes processing the first delivery.

Reproduction

  1. Configure msteams channel with DM enabled
  2. Send a message to the bot while it's processing a previous turn (or even when idle — timing-dependent)
  3. Observe the agent session: the same message text appears twice, once as the direct inbound and once as a queued replay

Example

System: [2026-04-14 10:00:12 PDT] Teams DM from John Lian: what is the active memory plugin?
...agent processes and replies...
[Queued messages while agent was busy]
Queued #1 (from John Lian)
System: [2026-04-14 10:00:12 PDT] Teams DM from John Lian: what is the active memory plugin?

Same message ID, same timestamp, same content — delivered twice.

Impact

  • Agent sees and sometimes responds to the same message twice
  • Token waste from processing duplicate context
  • Confusing conversation flow

Environment

  • OpenClaw v2026.4.14
  • msteams plugin (bundled)
  • blockStreaming: false (also happened with true)
  • DM (personal) conversation type
  • Queue mode: default (no explicit messages.queue.byChannel.msteams set)

History

In v2026.3.13, this was caused by the msteams plugin firing both a system event AND the channel message for every DM. We patched it locally with an if (!isDirectMessage) guard on the system event path. The system event code path appears to have been removed in later versions, but the duplication persists through a different mechanism (possibly the collect/followup queue replay).

Expected behavior

Each inbound DM should appear exactly once in the agent's session context.

Metadata

Metadata

Assignees

Labels

duplicateThis issue or pull request already exists

Type

No type

Fields

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions