# NousResearch/hermes-agent · Reply/quote context propagation across chat adapters

## Open now

- 2 issues, 5 PRs open on GitHub.
- #27946: Matrix: quoted reply content not passed to LLM prompt
- #56607: \[Bug\]: Google Chat adapter drops \`quotedMessageMetadata\` — replies to a quoted message lose all context
- PR #28962: fix(matrix): preserve Element reply quote context
- PR #56614: fix(gateway): populate reply_to_text/reply_to_message_id from Google Chat quotedMessageMetadata
- PR #56622: fix(google_chat): populate reply_to_* fields from quotedMessageMetadata (#56607)
- PR #68428: fix: treat \[object Object\] sentinel as absent in Telegram reply_to_text
- PR #105137: fix(google-chat): preserve quoted reply context

These issues and PRs address missing or dropped reply-to and quoted message context across multiple chat platforms including Google Chat, WhatsApp, Matrix, and Telegram. Work spans adapter-level fixes and gateway-level logic to ensure reply context reaches agents and LLM prompts.

## TL;DR

- 15 member(s): 2 open issue(s), 2 closed issue(s), 5 open PR(s), 1 merged PR(s), 5 PR(s) closed without merging.
- A fix was merged to main in PR #1662. Verify it addresses your case.
- **Recommended:** read PR #1662 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `partially_resolved` · deciding PR(s): `pr-1662`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_PARTIAL`): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text.
- Members outside that structural core may belong to a different underlying problem.
- Pairwise link density `0.12`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Open related issues

- #27946: Matrix: quoted reply content not passed to LLM prompt
- #56607: \[Bug\]: Google Chat adapter drops \`quotedMessageMetadata\` — replies to a quoted message lose all context

## Closed / duplicate issues

- #1594: feat(gateway): inject reply-to message context when quoted message is not in session history
- #28823: \[Bug\]: WhatsApp: quotedMessageId/context is not forwarded to agent — reply context is lost

## Prior & competing PRs

- **#1662: feat(gateway): inject reply-to message context for out-of-session replies (#1594)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `gateway/platforms/base.py`, `gateway/platforms/telegram.py`, `gateway/run.py`
  - fix hunks:
  - `gateway/platforms/base.py`

    ```diff
    @@ -294,6 +294,7 @@ class MessageEvent:
         
         # Reply context
         reply_to_message_id: Optional[str] = None
    +    reply_to_text: Optional[str] = None  # Text of the replied-to message (for context injection)
         
         # Timestamps
         timestamp: datetime = field(default_factory=datetime.now)
    ```
  - `gateway/platforms/telegram.py`

    ```diff
    @@ -1185,11 +1185,20 @@ def _build_message_event(self, message: Message, msg_type: MessageType) -> Messa
                 thread_id=str(message.message_thread_id) if message.message_thread_id else None,
             )
             
    +        # Extract reply context if this message is a reply
    +        reply_to_id = None
    +        reply_to_text = None
    +        if message.reply_to_message:
    +            reply_to_id = str(message.reply_to_message.message_id)
    +            reply_to_text = message.reply_to_message.text or message.reply_to_message.caption or None
    +
             return MessageEvent(
                 text=message.text or "",
                 message_type=msg_type,
                 source=source,
                 raw_message=message,
                 message_id=str(message.message_id),
    +            reply_to_message_id=reply_to_id,
    +            reply_to_text=reply_to_text,
                 timestamp=message.date,
             )
    ```
  - `gateway/run.py`

    ```diff
    @@ -1849,6 +1849,23 @@ async def _handle_message(self, event: MessageEvent) -> Optional[str]:
                         )
                     message_text = f"{context_note}\n\n{message_text}"
     
    +        # -----------------------------------------------------------------
    +        # Inject reply context when user replies to a message not in history.
    +        # Telegram (and other platforms) let users reply to specific messages,
    +        # but if the quoted message is from a previous session, cron delivery,
    +        # or background task, the agent has no context about what's being
    +        # referenced. Prepend the quoted text so the agent understands. (#1594)
    +        # -----------------------------------------------------------------
    +        if getattr(event, 'reply_to_text', None) and event.reply_to_message_id:
    +            reply_snippet = event.reply_to_text[:500]
    +            found_in_history = any(
    +                reply_snippet[:200] in (msg.get("content") or "")
    +                for msg in history
    +                if msg.get("role") in ("assistant", "user", "tool")
    +            )
    +            if not found_in_history:
    +                message_text = f'[Replying to: "{reply_snippet}"]\n\n{message_text}'
    +
             try:
                 # Emit agent:start hook
                 hook_ctx = {
    ```
- **#1596: feat(gateway): inject reply-to message context for out-of-session replies**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#1662`
- **#16552: fix: propagate WhatsApp reply context**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `11627fdcb92a0ad57c9b637538f8fbea39142272`
- **#27983: fix(matrix): re-inject quoted reply context into LLM prompt (#27946)**. closed without merge
  - maintainer direction: category `stale_abandoned`; implication `active`
- **#28878: fix(whatsapp): forward quotedMessageId/context to agent prompt**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `11627fdcb92a0ad57c9b637538f8fbea39142272`, `#28823`
- **#28962: fix(matrix): preserve Element reply quote context**. open
  - maintainer direction: category `uncategorized`; implication `needs_llm`; refs `7744377a41245c237a704f87b452739d1bad028a`
  - files: `gateway/platforms/matrix.py`, `tests/gateway/test_matrix_mention.py`
- **#56614: fix(gateway): populate reply_to_text/reply_to_message_id from Google Chat quotedMessageMetadata**. open
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#105137`
  - files: `plugins/platforms/google_chat/adapter.py`, `tests/gateway/test_google_chat.py`
- **#56622: fix(google_chat): populate reply_to_* fields from quotedMessageMetadata (#56607)**. open
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#56614`, `#56607`
  - files: `plugins/platforms/google_chat/adapter.py`, `tests/gateway/test_google_chat.py`, `tests/gateway/test_google_chat_sender.py`
- **#57171: fix(google-chat): preserve quoted reply context**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#56614`
- **#68428: fix: treat \[object Object\] sentinel as absent in Telegram reply_to_text**. open
  - maintainer direction: category `partial_fix`; implication `needs_llm`; refs `854c2ce30922200aedb96e0f609697433efd2ec6`, `854c2ce309`, `e889332c99`, `eaef9c99934f`, `#1596`, `#1662`, `#2694`, `#22632`, `#22633`, `#22676`, `#22709`, `#23091`, `#70631`, `#43200`, `#47487`, `#54262`, `#56203`, `#68428`, `#1596`, `#1662`, `#1662`, `#1594`, `#1596`, `#1594`, `#2694`, `#22676`, `#22632`, `#22676`, `#22633`, `#22632`, `#22676`, `#22676`, `#22632`, `#22619`, `#22709`, `#22676`, `#23091`, `#22676`, `#43200`, `#47487`, `#54262`, `#56203`, `#68428`, `#70631`, `#1596`, `#1662`, `#1594`, `#1662`, `#22632`, `#22633`, `#22676`, `#22709`, `#23091`, `#22619`, `#22676`, `#2694`, `#70631`, `#68428`, `#43200`, `#47487`, `#54262`, `#56203`, `#1662`, `#22676`
  - files: `plugins/platforms/telegram/adapter.py`, `tests/gateway/test_telegram_reply_quote.py`
- **#105137: fix(google-chat): preserve quoted reply context**. open
  - maintainer direction: category `uncategorized`; implication `needs_llm`; refs `#56614`, `#56622`, `#56607`, `#105111`, `#56614`, `#56614`, `#56622`, `#105137`
  - files: `plugins/platforms/google_chat/adapter.py`, `tests/gateway/test_google_chat.py`

## Fix status

- Merged to main in PR #1662 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-03-17`. This confirmation is old and may be out of date (a revert/reopen would not have invalidated it here); re-verify.
- Subsystem: `gateway`
