hermes - 💡(How to fix) Fix WhatsApp and WeChat forward multiple messages without debounce, wasting tokens and degrading UX

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…

Fix Action

Fix / Workaround

  • _text_batch_delay_seconds / _text_batch_split_delay_seconds (configurable via env vars)
  • _pending_text_batches dict for per-session aggregation
  • _enqueue_text_event() concatenates successive TEXT messages and resets the flush timer
  • _flush_text_batch() dispatches after the quiet period expires
RAW_BUFFERClick to expand / collapse

Problem

WhatsApp and WeChat (Weixin/iLink) both deliver messages individually without any client-side batching. When a user sends multiple messages in rapid succession (e.g. forwarded batches, paste-splits, or multi-line text split by the bridge), each fragment triggers a separate agent invocation.

This causes two problems:

  1. Token waste — Each invocation rebuilds the system prompt and context, so N fragments cost roughly N× the token budget vs. a single combined request.
  2. Degraded UX — The user receives N separate reply fragments instead of one coherent response. The fragments may arrive out of order or interleave with ongoing conversations.

Platform comparison

PlatformClient-side batching?Debounce in hermes-agent?
TelegramYes (4096-char splits)✅ Yes (built-in)
WeComYes (~4000-char splits)✅ Yes (built-in)
FeishuYes✅ Yes (built-in)
WhatsAppNo❌ None
WeChat (iLink)No❌ None

The Telegram, WeCom, and Feishu adapters already have a proven text-debounce pattern. WhatsApp and WeChat should follow suit.

Proposed solution

Add text-debounce batching to both adapters, mirroring the existing Telegram adapter pattern:

  • _text_batch_delay_seconds / _text_batch_split_delay_seconds (configurable via env vars)
  • _pending_text_batches dict for per-session aggregation
  • _enqueue_text_event() concatenates successive TEXT messages and resets the flush timer
  • _flush_text_batch() dispatches after the quiet period expires

Configurable via:

  • HERMES_WHATSAPP_TEXT_BATCH_DELAY_SECONDS (default 5.0s)
  • HERMES_WHATSAPP_TEXT_BATCH_SPLIT_DELAY_SECONDS (default 10.0s)
  • HERMES_WEIXIN_TEXT_BATCH_DELAY_SECONDS (default 3.0s)
  • HERMES_WEIXIN_TEXT_BATCH_SPLIT_DELAY_SECONDS (default 5.0s)

Implementation

PR forthcoming — implementation adds ~80 lines to whatsapp.py and ~90 lines to weixin.py.

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

hermes - 💡(How to fix) Fix WhatsApp and WeChat forward multiple messages without debounce, wasting tokens and degrading UX