openclaw - 💡(How to fix) Fix WeCom channel: batch image messages bypass inbound debounce, causing image loss [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#69623Fetched 2026-04-22 07:50:03
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

When a user sends multiple images at once via the WeCom channel, some images are lost and never reach the agent. Sending 14 images results in receiving only 11. This is a systemic issue with how messages.inbound.debounceMs handles media messages.

Root Cause

Per the official documentation (Configuration Reference):

Inbound debounce: "Batches rapid text-only messages from the same sender into a single agent turn. Media/attachments flush immediately."

This means:

  • Text messages are correctly batched by debounceMs
  • Image messages bypass debounce entirely — each image triggers an immediate agent run
  • When 14 images arrive via WebSocket within ~1-2 seconds, the first image triggers processing before the remaining images have been fully received/delivered

Fix Action

Fix / Workaround

Attempted Workarounds (All Failed)

Workaround for Users

Code Example

{
  messages: {
    inbound: {
      debounceMs: 10000,
      byChannel: { wecom: 10000 }
    }
  }
}

---

{
  messages: {
    queue: {
      mode: "collect",
      debounceMs: 10000,
      cap: 50,
      drop: "summarize"
    }
  }
}

---

{
  messages: {
    inbound: {
      debounceMs: 2000,
      mediaCollectWindow: 5000  // NEW: wait N ms for media before processing
    }
  }
}
RAW_BUFFERClick to expand / collapse

Bug Report: Media messages bypass inbound debounce, causing image loss on WeCom channel

Environment

  • OpenClaw Version: 2026.3.28 (f9b1079)
  • Channel: WeCom (企业微信) via @wecom/[email protected]
  • Connection Mode: WebSocket
  • Model: dashscope-coding/qwen3.6-plus

Summary

When a user sends multiple images at once via the WeCom channel, some images are lost and never reach the agent. Sending 14 images results in receiving only 11. This is a systemic issue with how messages.inbound.debounceMs handles media messages.

Root Cause

Per the official documentation (Configuration Reference):

Inbound debounce: "Batches rapid text-only messages from the same sender into a single agent turn. Media/attachments flush immediately."

This means:

  • Text messages are correctly batched by debounceMs
  • Image messages bypass debounce entirely — each image triggers an immediate agent run
  • When 14 images arrive via WebSocket within ~1-2 seconds, the first image triggers processing before the remaining images have been fully received/delivered

Reproduction

  1. Send 14 images simultaneously in a WeCom DM to the bot
  2. Observe: only 11 images are received (3 lost)
  3. The lost images are not recoverable — they don't appear in the conversation history or queue

Test Results

TestImages SentImages ReceivedLost
Single image110
3 images (sequential)330
14 images (batch)14113

Attempted Workarounds (All Failed)

1. messages.inbound.debounceMs

{
  messages: {
    inbound: {
      debounceMs: 10000,
      byChannel: { wecom: 10000 }
    }
  }
}

Result: No effect. Documented behavior — media flushes immediately regardless of debounce setting.

2. messages.queue collect mode

{
  messages: {
    queue: {
      mode: "collect",
      debounceMs: 10000,
      cap: 50,
      drop: "summarize"
    }
  }
}

Result: Partial improvement. Images arriving after an agent run has started get queued, but the first batch (images arriving before the agent run starts) each triggers its own separate agent run. This results in the agent replying to images 1, 2, 3 individually, then batch-processing the remaining 11.

3. Comparing with DingTalk channel

The DingTalk connector (@dingtalk-real-ai/dingtalk-connector) handles multi-image messages better because DingTalk packs multiple images into a single richText message, which is processed as one unit. WeCom sends each image as a separate WebSocket message event, making the problem inherent to the channel architecture.

Expected Behavior

All images sent in a batch should be collected into a single agent turn, similar to how inbound.debounceMs works for text messages. Users should not lose images when sending multiple images at once.

Proposed Fix

Add a mediaCollectWindow (or mediaDebounceMs) option that applies to media messages:

{
  messages: {
    inbound: {
      debounceMs: 2000,
      mediaCollectWindow: 5000  // NEW: wait N ms for media before processing
    }
  }
}

Or alternatively, make inbound.debounceMs apply to media messages by default (with the current "flush immediately" behavior opt-in).

Impact

This affects any use case involving batch image uploads via WeCom:

  • Mahjong score tracking (users send 10+ game result screenshots)
  • Receipt/invoice batch processing
  • Product catalog submissions
  • Any multi-image workflow

Workaround for Users

  • Send images in smaller batches (5-6 at a time)
  • Send as a zip/compressed file instead
  • Switch to DingTalk channel (which packs images into a single richText message)

Files Investigated

  • ~/.openclaw/extensions/wecom-openclaw-plugin/dist/index.esm.js (WeCom plugin)
    • parseMessageContent() — each image is a separate body.image event
    • processWeComMessage() — called per-image, no batch collection
    • wsClient.on("message") — each WebSocket frame triggers immediate processing
  • /usr/lib/node_modules/openclaw/docs/gateway/configuration-reference.md (line ~1703)
  • /usr/lib/node_modules/openclaw/docs/concepts/messages.md (line ~64)

extent analysis

TL;DR

Implement a mediaCollectWindow option to collect media messages for a specified time before processing, addressing the issue of lost images on the WeCom channel.

Guidance

  • Review the proposed fix of adding a mediaCollectWindow option to the messages.inbound configuration, allowing media messages to be collected for a specified time before processing.
  • Consider the alternative approach of making inbound.debounceMs apply to media messages by default, with an option to opt-in to the current "flush immediately" behavior.
  • Evaluate the impact of this change on existing use cases involving batch image uploads via WeCom, such as Mahjong score tracking and receipt/invoice batch processing.
  • In the short term, advise users to send images in smaller batches (5-6 at a time) or switch to the DingTalk channel, which packs images into a single richText message.

Example

{
  messages: {
    inbound: {
      debounceMs: 2000,
      mediaCollectWindow: 5000  // wait 5 seconds for media before processing
    }
  }
}

Notes

The WeCom channel's architecture, which sends each image as a separate WebSocket message event, contributes to the problem. The proposed fix aims to mitigate this issue by introducing a media message collection window.

Recommendation

Apply the proposed workaround by adding a mediaCollectWindow option to the messages.inbound configuration, as it directly addresses the root cause of the issue and provides a flexible solution for handling media messages.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix WeCom channel: batch image messages bypass inbound debounce, causing image loss [1 participants]