openclaw - 💡(How to fix) Fix [Bug] Image sent twice via weixin plugin - duplicate sendImageMessageWeixin calls for same mediaUrl [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#68563Fetched 2026-04-19 15:10:05
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Root Cause

Two concurrent code paths both process the same mediaUrl:

  1. sendFinalPayload (final reply path) → normalizeReplyMediaPayload → uploads
  2. onToolResult callback (tool result path) → normalizeReplyMediaPayload → uploads

These appear to run concurrently in dispatchReplyFromConfig, each calling normalizeReplyMediaPayload which creates a separate temp file copy, resulting in two separate uploads.

Fix Action

Fix / Workaround

These appear to run concurrently in dispatchReplyFromConfig, each calling normalizeReplyMediaPayload which creates a separate temp file copy, resulting in two separate uploads.

N/A - issue appears to be in core dispatch logic, not plugin-specific code.

Code Example

19:10:13.227  outbound: mediaUrl=present
19:10:13.640  sendImageMessageWeixin: filekey=74546e9d2a9dacb0b08f73007d3a5fc9 fileSize=15828 (attempt 1)
19:10:13.902  outbound: mediaUrl=present (same contextToken, different temp file)
19:10:14.254  sendImageMessageWeixin: filekey=cfe2803775b65b1c4df0c14a7b245739 fileSize=15828 (attempt 2)
RAW_BUFFERClick to expand / collapse

Bug Description

When replying with a MEDIA:/path/to/image.png directive in the weixin plugin, the image is sent twice to the recipient. Both images are identical (same file size: 15828 bytes) but have different file keys, indicating two separate upload+send operations.

Steps to Reproduce

  1. Use agent-browser to take a screenshot
  2. Output MEDIA:/tmp/screenshot.png as a reply
  3. Observe that wechat receives two identical images

Expected Behavior

Image should be sent exactly once.

Actual Behavior

Log shows two separate sendImageMessageWeixin calls at the same millisecond, with different filekey values but identical fileSize:

19:10:13.227  outbound: mediaUrl=present
19:10:13.640  sendImageMessageWeixin: filekey=74546e9d2a9dacb0b08f73007d3a5fc9 fileSize=15828 (attempt 1)
19:10:13.902  outbound: mediaUrl=present (same contextToken, different temp file)
19:10:14.254  sendImageMessageWeixin: filekey=cfe2803775b65b1c4df0c14a7b245739 fileSize=15828 (attempt 2)

Both images arrive in wechat as identical 15KB files.

Root Cause Analysis

Two concurrent code paths both process the same mediaUrl:

  1. sendFinalPayload (final reply path) → normalizeReplyMediaPayload → uploads
  2. onToolResult callback (tool result path) → normalizeReplyMediaPayload → uploads

These appear to run concurrently in dispatchReplyFromConfig, each calling normalizeReplyMediaPayload which creates a separate temp file copy, resulting in two separate uploads.

Environment

  • OpenClaw version: latest
  • Plugin: openclaw-weixin (latest)
  • Channel: weixin (direct chat)

Plugin Version

N/A - issue appears to be in core dispatch logic, not plugin-specific code.

Suggested Fix

Deduplicate media payloads before sending, or ensure normalizeReplyMediaPayload is called only once per unique mediaUrl in a single reply cycle.

extent analysis

TL;DR

To fix the issue of sending duplicate images, ensure that normalizeReplyMediaPayload is called only once per unique mediaUrl in a single reply cycle.

Guidance

  • Review the dispatchReplyFromConfig function to identify how sendFinalPayload and onToolResult callback are triggered and ensure they do not concurrently process the same mediaUrl.
  • Consider implementing a deduplication mechanism for media payloads before sending to prevent duplicate uploads.
  • Investigate the normalizeReplyMediaPayload function to see if it can be modified to check for existing temp file copies before creating a new one.
  • Verify that the fix does not introduce any race conditions or other concurrency issues.

Example

No code example is provided as the issue is related to the core dispatch logic and requires a deeper understanding of the codebase.

Notes

The suggested fix assumes that the issue is indeed caused by the concurrent execution of sendFinalPayload and onToolResult callback. Further investigation may be needed to confirm this.

Recommendation

Apply a workaround to ensure normalizeReplyMediaPayload is called only once per unique mediaUrl in a single reply cycle, as this is the most likely cause of the issue and can be addressed without requiring a full understanding of the codebase.

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 [Bug] Image sent twice via weixin plugin - duplicate sendImageMessageWeixin calls for same mediaUrl [1 participants]