fix(whatsapp): lower default debounce delays to match Telegram cadence - #44896
fix(whatsapp): lower default debounce delays to match Telegram cadence#44896liuhao1024 wants to merge 1 commit into
Conversation
PR NousResearch#35391 introduced text-debounce batching for WhatsApp with defaults of 5.0s / 10.0s — 16× slower than Telegram's 0.3s / 1.0s. A single "hello" message waits 5 seconds of dead silence before the agent responds, and most users will never discover the config knob. Lower the defaults to 0.3s / 2.0s, matching the Telegram adapter's TTFT-optimised cadence. Operators can still override via config.yaml (gateway.platforms.whatsapp.extra.text_batch_delay_seconds). Fixes NousResearch#44883
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Clean config fix. WhatsApp text batching delays reduced from 5.0s/10.0s to 0.3s/2.0s to match the Telegram adapter cadence.
Looks Good
- Lower delays mean faster response for WhatsApp users without flooding
- Existing tests updated to match new defaults
- Config fallback logic unchanged — garbage/invalid values still fall back to new defaults
- Clear documentation noting this matches Telegram adapter behavior
Reviewed by Hermes Agent
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused latency fix. The premise still holds on current main: plugins/platforms/whatsapp/adapter.py:436-441 retains the 5.0s/10.0s defaults, which _flush_text_batch() awaits before dispatch at plugins/platforms/whatsapp/adapter.py:1315-1325.
Problems
- The PR modifies the retired
gateway/platforms/whatsapp.py; the live adapter moved toplugins/platforms/whatsapp/adapter.pyin560010547(2026-06-19), so this diff would not alter current runtime behavior. website/docs/user-guide/messaging/whatsapp.md:214-223would continue to document 5s/10s after the code change.
Suggested changes
- Salvage the default and test assertions onto the plugin adapter/current test import, and update the WhatsApp configuration example.
- Clarify the 2.0s split choice: Telegram currently uses 1.0s at
plugins/platforms/telegram/adapter.py:572-576.
This is an automated hermes-sweeper review.
| adapter = _make_adapter() | ||
| assert adapter._text_batch_delay_seconds == 5.0 | ||
| assert adapter._text_batch_split_delay_seconds == 10.0 | ||
| assert adapter._text_batch_delay_seconds == 0.3 |
There was a problem hiding this comment.
Current main's test already imports plugins.platforms.whatsapp.adapter, but the production half of this PR still edits the retired gateway/platforms/whatsapp.py. Port the matching defaults to plugins/platforms/whatsapp/adapter.py; otherwise this updated assertion will not match runtime behavior.
What does this PR do?
Lowers the WhatsApp adapter's default text-batch debounce delays from 5.0s/10.0s to 0.3s/2.0s, matching the Telegram adapter's TTFT-optimised cadence. A single "hello" message previously waited 5 seconds of dead silence before the agent responded.
Related Issue
Fixes #44883
Type of Change
Changes Made
gateway/platforms/whatsapp.py: Changedtext_batch_delay_secondsdefault from 5.0 to 0.3,text_batch_split_delay_secondsfrom 10.0 to 2.0. Updated docstring comment.tests/gateway/test_whatsapp_text_batching.py: Updated 3 test assertions to match new defaults (default test, invalid-config fallback test, env-var-ignored test).How to Test
text_batch_delay_secondsoverride still works: setgateway.platforms.whatsapp.extra.text_batch_delay_seconds: 1.0in config.yaml and confirm the delay changespytest tests/gateway/test_whatsapp_text_batching.py -q— all 6 tests passChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/gateway/test_whatsapp_text_batching.py -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/ACode Intelligence
gateway/platforms/whatsapp.py(debounce init),tests/gateway/test_whatsapp_text_batching.py(6 tests)_coerce_float_extrafor batch delays: WhatsAppAdapter.init only_env_float_clamped(PR perf(gateway): tune Telegram cadence + adaptive fast-path for short replies (salvage of #10388) #23587). Matrix adapter also usestext_batch_delay_secondswith similar config.extra pattern.