Skip to content

fix: propagate WhatsApp reply context - #16552

Closed
tkwong wants to merge 1 commit into
NousResearch:mainfrom
tkwong:fix/whatsapp-reply-context
Closed

fix: propagate WhatsApp reply context#16552
tkwong wants to merge 1 commit into
NousResearch:mainfrom
tkwong:fix/whatsapp-reply-context

Conversation

@tkwong

@tkwong tkwong commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • extract quoted message id and text from Baileys contextInfo in the WhatsApp bridge
  • pass quoted reply metadata through the WhatsApp adapter into MessageEvent.reply_to_message_id / reply_to_text
  • add regression tests covering event construction and gateway reply-context injection

Test Plan

  • /opt/homebrew/bin/node --check scripts/whatsapp-bridge/bridge.js
  • pytest tests/gateway/test_whatsapp_reply_context.py tests/gateway/test_whatsapp_group_gating.py -q

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists platform/whatsapp WhatsApp Business adapter comp/gateway Gateway runner, session dispatch, delivery labels Apr 27, 2026
@anand-agastya

Copy link
Copy Markdown

We've been running this fix locally (both bridge.js + whatsapp.py changes) and it works correctly. When a user replies to a WhatsApp message, the agent sees [Replying to: "the quoted text"] prepended.

Tested with conversation, extendedText, image caption, and video caption quoted messages.

Would be great to see this merged — reply context is lost without it, and it's been open since April.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused WhatsApp reply-context fix. This is now implemented on current main; automated hermes-sweeper review found that the PR is superseded by a later WhatsApp refactor.

  • scripts/whatsapp-bridge/bridge_helpers.js:311-317 extracts Baileys contextInfo, including quoted message ID and text, and returns it at :480-484.
  • plugins/platforms/whatsapp/adapter.py:1439-1455 maps that metadata into structured reply fields, passed to MessageEvent at :1514-1517.
  • gateway/run.py:10572-10586 renders the agent-visible [Replying to: "…"] pointer.
  • Commit 11627fdcb92a0ad57c9b637538f8fbea39142272 introduced this implementation and is contained in release tag v2026.7.7.

The original gateway/platforms/whatsapp.py target was subsequently migrated to the bundled plugin adapter, so this branch's patch is no longer needed.

@teknium1 teknium1 closed this Jul 12, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/whatsapp WhatsApp Business adapter sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants