hermes - 💡(How to fix) Fix WhatsApp streaming broken in v0.10.0: edit_message() rejects 'finalize' kwarg

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…

In Hermes v0.10.0, enabling streaming breaks WhatsApp replies. The gateway.stream_consumer calls _send_or_edit(..., finalize=...) which forwards finalize as a kwarg to the platform adapter's edit_message(). The WhatsApp adapter's edit_message() signature only accepts (chat_id, message_id, content) — no finalize — so every stream update raises TypeError: edit_message() got an unexpected keyword argument 'finalize'. Retries all fail; WhatsApp users see silent delivery failures or long delays.

Error Message

ERROR gateway.stream_consumer: Stream send/edit error: WhatsAppAdapter.edit_message() got an unexpected keyword argument 'finalize'

Root Cause

gateway/stream_consumer.py:380 passes finalize:

current_update_visible = await self._send_or_edit(
    display_text,
    finalize=got_segment_break,
)

gateway/platforms/whatsapp.py:653 does not accept it:

async def edit_message(
    self,
    chat_id: str,
    message_id: str,
    content: str,
) -> SendResult:

The Telegram adapter at gateway/platforms/telegram.py:1079 has the same signature, so presumably it hits the same issue — but perhaps _send_or_edit is filtering the kwarg for some adapters via _adapter_requires_finalize (referenced at stream_consumer.py:108) and WhatsApp isn't in that code path.

Fix Action

Fix / Workaround

Any deployment with streaming enabled on WhatsApp is effectively broken — messages arrive late or not at all, users experience the system as unreliable. Current workaround is streaming.enabled: false, which works but loses the streaming UX benefit on platforms where it does work (CLI, Telegram).

Code Example

ERROR gateway.stream_consumer: Stream send/edit error:
    WhatsAppAdapter.edit_message() got an unexpected keyword argument 'finalize'

---

streaming:
     enabled: true

---

current_update_visible = await self._send_or_edit(
    display_text,
    finalize=got_segment_break,
)

---

async def edit_message(
    self,
    chat_id: str,
    message_id: str,
    content: str,
) -> SendResult:

---

async def edit_message(
    self,
    chat_id: str,
    message_id: str,
    content: str,
    *,
    finalize: bool = False,
    **_kwargs,
) -> SendResult:
    # WhatsApp edits don't require explicit finalize; just perform the edit.
    ...
RAW_BUFFERClick to expand / collapse

Summary

In Hermes v0.10.0, enabling streaming breaks WhatsApp replies. The gateway.stream_consumer calls _send_or_edit(..., finalize=...) which forwards finalize as a kwarg to the platform adapter's edit_message(). The WhatsApp adapter's edit_message() signature only accepts (chat_id, message_id, content) — no finalize — so every stream update raises TypeError: edit_message() got an unexpected keyword argument 'finalize'. Retries all fail; WhatsApp users see silent delivery failures or long delays.

Environment

  • Hermes version: v0.10.0 (2026.4.16)
  • Platform: macOS (Darwin 25.2.0), Python 3.11.13
  • Profiles affected: both default and custom profiles (--profile wife)
  • Provider: gemini (provider: gemini, model.default: gemini-3-flash-preview)
  • Adapter: Baileys-based WhatsApp bridge

Error trace (15+ occurrences in ~1 min)

ERROR gateway.stream_consumer: Stream send/edit error:
    WhatsAppAdapter.edit_message() got an unexpected keyword argument 'finalize'

Reproduction

  1. hermes/config.yaml with:
    streaming:
      enabled: true
  2. Connect a WhatsApp gateway (hermes gateway setup + QR scan).
  3. Send any message from WhatsApp to the gateway.
  4. Observe: reply fails to arrive, or arrives after significant delay. ~/.hermes/logs/gateway.error.log floods with the finalize error.

Root cause

gateway/stream_consumer.py:380 passes finalize:

current_update_visible = await self._send_or_edit(
    display_text,
    finalize=got_segment_break,
)

gateway/platforms/whatsapp.py:653 does not accept it:

async def edit_message(
    self,
    chat_id: str,
    message_id: str,
    content: str,
) -> SendResult:

The Telegram adapter at gateway/platforms/telegram.py:1079 has the same signature, so presumably it hits the same issue — but perhaps _send_or_edit is filtering the kwarg for some adapters via _adapter_requires_finalize (referenced at stream_consumer.py:108) and WhatsApp isn't in that code path.

Suggested fix (either one works)

Option A — Accept the kwarg in adapters Update edit_message() signatures in the WhatsApp adapter (and Telegram, if affected) to absorb unknown kwargs:

async def edit_message(
    self,
    chat_id: str,
    message_id: str,
    content: str,
    *,
    finalize: bool = False,
    **_kwargs,
) -> SendResult:
    # WhatsApp edits don't require explicit finalize; just perform the edit.
    ...

Option B — Guard in the stream consumer Only pass finalize to adapters that set _adapter_requires_finalize = True; drop it for others. This already appears to be the intent given the check at stream_consumer.py:394, but the call at line 380 passes finalize unconditionally.

Impact

Any deployment with streaming enabled on WhatsApp is effectively broken — messages arrive late or not at all, users experience the system as unreliable. Current workaround is streaming.enabled: false, which works but loses the streaming UX benefit on platforms where it does work (CLI, Telegram).

Happy to submit a PR

If you confirm the preferred fix (Option A or B), I can put together a PR against main.

extent analysis

TL;DR

The most likely fix is to update the WhatsApp adapter's edit_message() signature to accept the finalize keyword argument or modify the stream_consumer to conditionally pass finalize based on the adapter's requirements.

Guidance

  • Verify that the issue is indeed caused by the finalize keyword argument being passed to the WhatsApp adapter's edit_message() method by checking the error logs and the code at gateway/stream_consumer.py:380 and gateway/platforms/whatsapp.py:653.
  • Consider implementing Option A by updating the edit_message() signatures in the WhatsApp adapter (and potentially Telegram) to absorb unknown kwargs, as shown in the suggested fix.
  • Alternatively, explore Option B by modifying the stream_consumer to conditionally pass finalize based on the adapter's requirements, ensuring that the check at stream_consumer.py:394 is correctly implemented.
  • Before making any changes, ensure that the fix does not introduce any unintended side effects or compatibility issues with other adapters or platforms.

Example

async def edit_message(
    self,
    chat_id: str,
    message_id: str,
    content: str,
    *,
    finalize: bool = False,
    **_kwargs,
) -> SendResult:
    # WhatsApp edits don't require explicit finalize; just perform the edit.
    ...

Notes

The provided information suggests that the issue is specific to the WhatsApp adapter, but it is essential to verify that the fix does not affect other adapters or platforms. Additionally, it is crucial to test the changes thoroughly to ensure that the streaming functionality works as expected.

Recommendation

Apply Option A, as it seems to be a more straightforward and adapter-specific solution, allowing the WhatsApp adapter to handle the finalize keyword argument without requiring changes to the stream_consumer. This approach also aligns with the suggested fix provided in the issue.

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