Skip to content

fix(whatsapp): preserve stanza-only quote context - #76075

Open
embwl0x wants to merge 1 commit into
NousResearch:mainfrom
embwl0x:agent/issue-74380-whatsapp-quote-context
Open

fix(whatsapp): preserve stanza-only quote context#76075
embwl0x wants to merge 1 commit into
NousResearch:mainfrom
embwl0x:agent/issue-74380-whatsapp-quote-context

Conversation

@embwl0x

@embwl0x embwl0x commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Closes #74380

Summary

  • treat a Baileys stanzaId as authoritative reply metadata even when the inline quotedMessage payload is absent
  • recover quoted text from the bridge's bounded message store when available and retain the reply ID through the Python adapter when it is not
  • render an explicit WhatsApp message-ID pointer when the quoted payload has been evicted, so queued instructions do not become contextless

Scope

PR #73399 owns durable platform_metadata persistence. This PR deliberately does not duplicate that schema work; it fixes the earlier live bridge -> adapter -> queued-turn rendering path.

Verification

  • node --check for both changed bridge modules
  • node scripts/whatsapp-bridge/bridge.native.test.mjs
  • scripts/run_tests.sh tests/gateway/test_whatsapp_formatting.py tests/gateway/test_reply_to_injection.py tests/gateway/test_queue_command.py tests/gateway/test_whatsapp_native_delivery.py -q (18 passed)
  • Ruff on changed Python files
  • contribution publish gate and gitleaks

@embwl0x
embwl0x force-pushed the agent/issue-74380-whatsapp-quote-context branch from cfc4444 to d6653e5 Compare August 1, 2026 10:15
@embwl0x

embwl0x commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Rebased without conflicts onto current main 84952e89f after the first CI run hit an unrelated test_update_eol_churn.py file-count failure. The WhatsApp diff is unchanged; native bridge tests and the 18 targeted Python tests pass again on the new base. The force-push also retriggers CI because upstream workflow reruns require maintainer/admin rights.

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins platform/whatsapp WhatsApp Business adapter P2 Medium — degraded but workaround exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Aug 1, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: #73399 addresses durable platform-metadata persistence; this PR fixes the earlier WhatsApp bridge-to-adapter-to-queued-turn reply-context path.

@teknium1

teknium1 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Thanks for narrowing this to the live WhatsApp bridge-to-adapter path. Current origin/main confirms the premise: scripts/whatsapp-bridge/bridge_helpers.js:313-317 retains stanzaId but marks a reply only when an inline payload exists; plugins/platforms/whatsapp/adapter.py:1506-1513 consequently drops the reply ID; and gateway/run.py:15319-15333 cannot render an ID-only reply pointer.

The change in d6653e513b5d addresses each confirmed loss point while leaving the existing /queue payload copy (gateway/run.py:13503-13507) intact. The bridge tests cover recovered and evicted quote payloads, and the Python tests cover adapter mapping plus the agent-visible fallback. GitHub compare reports the branch is zero commits behind current main.

Automated hermes-sweeper review.

@teknium1 teknium1 added the sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform label Aug 1, 2026
@GottZ

GottZ commented Aug 3, 2026

Copy link
Copy Markdown

This was generated by AI during triage.

Summary

One PR addresses #74380. #76075 fixes the live WhatsApp bridge-to-adapter-to-queued-turn loss of stanza-ID-only reply context, while durable canonical platform-metadata persistence remains assigned to #73399.

Related pull requests

Suggested consolidation

Keep #76075 open with a salvage path: retain its bridge extraction, adapter mapping, WhatsApp message-ID fallback, and targeted regression tests as the focused live-path fix, while leaving durable platform-metadata persistence to #73399. There are no competing PRs or duplicates to close.

Complex graph

flowchart LR
    classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
    classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
    classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
    classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
    classDef best stroke-width:3px,stroke:#b45309
    classDef target stroke-width:3px,stroke:#4338ca
    I74380(["issue #74380 (open)"])
    P76075["PR #76075 (open)"]
    P76075 -->|best fix| I74380
    class I74380 open
    class P76075 open
    class P76075 best
    class P76075 target
    click I74380 "https://github.com/NousResearch/hermes-agent/issues/74380"
    click P76075 "https://github.com/NousResearch/hermes-agent/pull/76075"
Loading

Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label).

Cross-PR triage: Reviewed 1 pull request and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 9 kB of PR diffs, 7 kB of issue/PR text, <1 kB of discussion (3 comments), 2 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

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 comp/plugins Plugin system and bundled plugins P2 Medium — degraded but workaround exists platform/whatsapp WhatsApp Business adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: WhatsApp /queue loses quoted-reply context before queued turn reaches agent

4 participants