hermes - ✅(Solved) Fix [Bug]: WhatsApp: quotedMessageId/context is not forwarded to agent — reply context is lost [1 pull requests, 3 comments, 3 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
NousResearch/hermes-agent#28823Fetched 2026-05-20 04:01:39
View on GitHub
Comments
3
Participants
3
Timeline
10
Reactions
0
Author
Timeline (top)
labeled ×4commented ×3cross-referenced ×1mentioned ×1

Root Cause

The data flow has the metadata, but it's dropped in the gateway adapter:

  1. Bridge (scripts/whatsapp-bridge/bridge.js lines 320-323, 435-437) extracts quotedMessageId, quotedParticipant, quotedRemoteJid, and hasQuotedMessage from the Baileys contextInfo object and sends them in the event payload.

  2. Adapter (gateway/platforms/whatsapp.py) receives the payload but only uses:

    • quotedParticipant → admission control (_message_is_reply_to_bot(), line 412)
    • body, senderId, senderName, chatId, isGroup, mediaUrls
    • quotedMessageId is never read or forwarded to the agent context

Fix Action

Fixed

PR fix notes

PR #28878: fix(whatsapp): forward quotedMessageId/context to agent prompt

Description (problem / solution / changelog)

The WhatsApp bridge (PR #25489) already extracts quotedMessageId, quotedParticipant, quotedRemoteJid, and hasQuotedMessage from Baileys' contextInfo, but the adapter in gateway/platforms/whatsapp.py only used quotedParticipant for admission control. The remaining fields were dropped, so reply-based corrections in WhatsApp lost all context — the agent only saw the new reply text with no reference to the quoted message.

This forwards the quoted-message context to the agent using the same shape as the Matrix adapter (see #27946 fix), keeping cross-platform behavior consistent. Non-reply messages are unchanged.

Fixes #28823

Changed files

  • gateway/platforms/whatsapp.py (modified, +11/-0)
  • tests/gateway/test_whatsapp_formatting.py (modified, +72/-0)
RAW_BUFFERClick to expand / collapse

Bug Description

When a user replies (quotes) a specific message in WhatsApp, the bridge extracts quotedMessageId and hasQuotedMessage from the message payload, but the WhatsApp adapter (whatsapp.py) discards this metadata — it never reaches the agent's prompt.

The agent only receives the user's new text, with no reference to what message was quoted or its content. This makes reply-based corrections unreliable — the user must retype the full item name instead of relying on WhatsApp's native reply feature.

This is the same class of bug as #27946 (Matrix: quoted reply content not passed to LLM prompt).

Steps to Reproduce

  1. Send a message in WhatsApp DM or group (e.g. "Please prioritize KL-42")
  2. Reply to that message with "Actually, change it to BL-99"
  3. The agent has no idea which message was quoted — it only sees "Actually, change it to BL-99"

Expected Behavior

The quoted message ID and/or content should be available in the agent context so it can understand which message the user is replying to.

Actual Behavior

The agent only receives the new reply text with zero context about the quoted message.

Affected Component

  • Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

  • WhatsApp

Root Cause Analysis

The data flow has the metadata, but it's dropped in the gateway adapter:

  1. Bridge (scripts/whatsapp-bridge/bridge.js lines 320-323, 435-437) extracts quotedMessageId, quotedParticipant, quotedRemoteJid, and hasQuotedMessage from the Baileys contextInfo object and sends them in the event payload.

  2. Adapter (gateway/platforms/whatsapp.py) receives the payload but only uses:

    • quotedParticipant → admission control (_message_is_reply_to_bot(), line 412)
    • body, senderId, senderName, chatId, isGroup, mediaUrls
    • quotedMessageId is never read or forwarded to the agent context

Proposed Fix

Short-term: In whatsapp.py, inject quotedMessageId into the session source or prepend it to the message body.

Long-term: Consider a generic "quoted message context" field across all platform adapters that support replies (WhatsApp, Matrix, Telegram, Slack).

Operating System

Ubuntu 24.04.4 LTS

Python Version

3.11.15

Hermes Version

0.14.0 (main @ f2fdb9a17)

Additional Context

Reported by @fabiofeichtinger

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

hermes - ✅(Solved) Fix [Bug]: WhatsApp: quotedMessageId/context is not forwarded to agent — reply context is lost [1 pull requests, 3 comments, 3 participants]