Skip to content

fix(whatsapp): send read receipts for inbound messages - #8690

Closed
sgaofen wants to merge 1 commit into
NousResearch:mainfrom
sgaofen:codex/whatsapp-read-receipts
Closed

fix(whatsapp): send read receipts for inbound messages#8690
sgaofen wants to merge 1 commit into
NousResearch:mainfrom
sgaofen:codex/whatsapp-read-receipts

Conversation

@sgaofen

@sgaofen sgaofen commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a small bridge helper that sends Baileys read receipts for inbound WhatsApp messages Hermes accepts for processing
  • invoke the helper after accepted inbound messages are queued so senders see blue-tick read confirmations
  • add focused Node tests for success, skip, and error-swallowing paths

Root Cause

The native WhatsApp bridge received inbound messages and forwarded them into Hermes, but it never called Baileys' read receipt flow for those messages. As a result, Hermes could respond while WhatsApp still showed the message as unread.

Closes #6055.

Testing

  • node --check scripts/whatsapp-bridge/bridge.js
  • node --check scripts/whatsapp-bridge/read_receipts.js
  • node --test scripts/whatsapp-bridge/read_receipts.test.mjs scripts/whatsapp-bridge/allowlist.test.mjs

Platform Tested

  • macOS 15.x (Apple Silicon)

Contribution Guide Notes

  • Reviewed CONTRIBUTING.md and checked for existing open PRs before submitting this scoped bug fix.
  • Ran the targeted verification commands listed above for this PR. I have not claimed a full repo-wide pytest tests/ -q pass unless explicitly noted.

@sgaofen sgaofen changed the title [codex] Send WhatsApp read receipts for inbound messages fix(whatsapp): send read receipts for inbound messages Apr 13, 2026
@sgaofen
sgaofen marked this pull request as ready for review April 13, 2026 00:51
@lobomfz lobomfz mentioned this pull request Apr 14, 2026
12 tasks
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have platform/whatsapp WhatsApp Business adapter comp/gateway Gateway runner, session dispatch, delivery labels Apr 28, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing PR — #9672 and #13185 also implement WhatsApp read receipts for #6055/#6539. Please coordinate to avoid merge conflicts.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for isolating the Baileys receipt call and covering its direct success, skip, and rejected-promise behavior. The premise remains valid on current main: accepted ordinary inbound messages are queued at scripts/whatsapp-bridge/bridge.js:750-764 without a readMessages call.

Problems

  • Current main now has an additional accepted native poll-update route. scripts/whatsapp-bridge/bridge.js:650-706 queues poll updates and continues before the ordinary-message tail, so the PR's receipt call would not cover poll votes processed by Hermes.

Suggested changes

  • Salvage the helper onto current main and invoke it after every accepted enqueue path, including the poll-update enqueue at scripts/whatsapp-bridge/bridge.js:701.
  • Make the receipt bounded or non-blocking instead of awaiting an unbounded socket promise in the per-message loop; current outbound Baileys operations use a timeout at scripts/whatsapp-bridge/bridge.js:136-147.
  • Add a regression test for the current poll-update path in addition to the helper unit tests.

This is an automated hermes-sweeper review.

if (messageQueue.length > MAX_QUEUE_SIZE) {
messageQueue.shift();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid awaiting an unbounded external socket call in the per-message upsert loop. The helper catches rejections but has no timeout, so a pending readMessages call can delay later messages in this batch; make this bounded or deliberately non-blocking.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 12, 2026
@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Merged via #73322 which salvaged #70340 by @maff-t2b — the most complete of the competing read receipts PRs. Thanks for your contribution!

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 P3 Low — cosmetic, nice to have platform/whatsapp WhatsApp Business adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WhatsApp read receipts not sent back to WhatsApp servers

4 participants