openclaw - 💡(How to fix) Fix WhatsApp group history drops media from unmentioned messages before later mention

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…

WhatsApp group messages that are stored for later context because requireMention: true preserve only the text body. If the unmentioned message contains an image, the pending group-history entry stores only <media:image> and drops mediaPath / mediaType. When the user later mentions OpenClaw and asks about the image, the agent sees the placeholder/history text but has no actual image attachment available.

This is the WhatsApp equivalent of the still-open Telegram history-media issue #40440, but it is a separate channel path.

Root Cause

WhatsApp group messages that are stored for later context because requireMention: true preserve only the text body. If the unmentioned message contains an image, the pending group-history entry stores only <media:image> and drops mediaPath / mediaType. When the user later mentions OpenClaw and asks about the image, the agent sees the placeholder/history text but has no actual image attachment available.

Fix Action

Fix / Workaround

  • extensions/whatsapp/src/auto-reply/monitor/group-gating.ts
    • GroupHistoryEntry only carries sender, body, timestamp, id, and senderJid.
    • recordPendingGroupHistoryEntry() records params.msg.body, but does not preserve params.msg.mediaPath, params.msg.mediaUrl, or params.msg.mediaType.
  • extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.ts
    • buildWhatsAppInboundContext() maps groupHistory into InboundHistory as text-only entries.
    • MediaPath/MediaUrl/MediaType come only from the current message, not pending group history.

A local patch that preserves mediaPath/mediaUrl/mediaType in WhatsApp pending group history and merges those historical media entries into the later mentioned turn context made the source-level regression test pass.

node scripts/run-vitest.mjs extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.test.ts extensions/whatsapp/src/auto-reply/monitor/group-gating.audio-preflight.test.ts
pnpm oxlint extensions/whatsapp/src/auto-reply/monitor/group-gating.ts extensions/whatsapp/src/auto-reply/monitor/inbound-context.ts extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.ts extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.test.ts extensions/whatsapp/src/auto-reply/monitor/group-gating.audio-preflight.test.ts
pnpm build

Code Example

node scripts/run-vitest.mjs extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.test.ts extensions/whatsapp/src/auto-reply/monitor/group-gating.audio-preflight.test.ts
pnpm oxlint extensions/whatsapp/src/auto-reply/monitor/group-gating.ts extensions/whatsapp/src/auto-reply/monitor/inbound-context.ts extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.ts extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.test.ts extensions/whatsapp/src/auto-reply/monitor/group-gating.audio-preflight.test.ts
pnpm build
RAW_BUFFERClick to expand / collapse

Summary

WhatsApp group messages that are stored for later context because requireMention: true preserve only the text body. If the unmentioned message contains an image, the pending group-history entry stores only <media:image> and drops mediaPath / mediaType. When the user later mentions OpenClaw and asks about the image, the agent sees the placeholder/history text but has no actual image attachment available.

This is the WhatsApp equivalent of the still-open Telegram history-media issue #40440, but it is a separate channel path.

Reproduction

  1. Configure a WhatsApp group with requireMention: true.
  2. In that group, send an image without mentioning OpenClaw.
  3. Then send a text message mentioning OpenClaw, such as claw what does the image say?.
  4. Observe that the agent cannot inspect the image and may answer that it received no image, only an empty/placeholder value.

Expected behavior

Unmentioned WhatsApp group media that is admitted for context should keep enough media metadata for the next mentioned turn to inspect it, subject to the same bounded retention/security constraints as normal inbound media.

Actual behavior

The unmentioned image is downloaded by the inbound path, but the group-history entry recorded by the mention-gating skip path only contains text fields. The later mentioned turn gets InboundHistory with <media:image> but no MediaPath/MediaPaths for the historical image.

Source-level proof

Current affected path:

  • extensions/whatsapp/src/auto-reply/monitor/group-gating.ts
    • GroupHistoryEntry only carries sender, body, timestamp, id, and senderJid.
    • recordPendingGroupHistoryEntry() records params.msg.body, but does not preserve params.msg.mediaPath, params.msg.mediaUrl, or params.msg.mediaType.
  • extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.ts
    • buildWhatsAppInboundContext() maps groupHistory into InboundHistory as text-only entries.
    • MediaPath/MediaUrl/MediaType come only from the current message, not pending group history.

I reproduced this locally on Windows with a live WhatsApp group: image sent without mention, then a later mention asking about the image produced an answer equivalent to ?I have no image received, only a ''?.

Local fix proof

A local patch that preserves mediaPath/mediaUrl/mediaType in WhatsApp pending group history and merges those historical media entries into the later mentioned turn context made the source-level regression test pass.

Validation run locally:

node scripts/run-vitest.mjs extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.test.ts extensions/whatsapp/src/auto-reply/monitor/group-gating.audio-preflight.test.ts
pnpm oxlint extensions/whatsapp/src/auto-reply/monitor/group-gating.ts extensions/whatsapp/src/auto-reply/monitor/inbound-context.ts extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.ts extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.test.ts extensions/whatsapp/src/auto-reply/monitor/group-gating.audio-preflight.test.ts
pnpm build

Observed result after local patch: targeted tests pass, build passes, and the gateway restarts with WhatsApp healthy/connected.

Notes / related issues

  • Related Telegram issue: #40440
  • Not a duplicate of #59174 / #22079: those cover quoted/replied WhatsApp media. This bug is about media from unmentioned group messages stored as pending context for a later mentioned turn.
  • Not a duplicate of #1694: that issue covered current-message image/caption delivery when the caption mentions the bot.

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…

FAQ

Expected behavior

Unmentioned WhatsApp group media that is admitted for context should keep enough media metadata for the next mentioned turn to inspect it, subject to the same bounded retention/security constraints as normal inbound media.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING