openclaw-vainplex/src/auto-reply
juanpablodlc 4a99b9b651
feat(whatsapp): add debounceMs for batching rapid messages (#971)
* feat(whatsapp): add debounceMs for batching rapid messages

Add a `debounceMs` configuration option to WhatsApp channel settings
that batches rapid consecutive messages from the same sender into a
single response. This prevents triggering separate agent runs for
each message when a user sends multiple short messages in quick
succession (e.g., "Hey!", "how are you?", "I was wondering...").

Changes:
- Add `debounceMs` config to WhatsAppConfig and WhatsAppAccountConfig
- Implement message buffering in `monitorWebInbox` with:
  - Map-based buffer keyed by sender (DM) or chat ID (groups)
  - Debounce timer that resets on each new message
  - Message combination with newline separator
  - Single message optimization (no modification if only one message)
- Wire `debounceMs` through account resolution and monitor tuning
- Add UI hints and schema documentation

Usage example:
{
  "channels": {
    "whatsapp": {
      "debounceMs": 5000  // 5 second window
    }
  }
}

Default behavior: `debounceMs: 0` (disabled by default)

Verified: All existing tests pass (3204 tests), TypeScript compilation
succeeds with no errors.

Implemented with assistance from AI coding tools.

Closes #967

* chore: wip inbound debounce

* fix: debounce inbound messages across channels (#971) (thanks @juanpablodlc)

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-01-15 23:07:19 +00:00
..
reply feat(date-time): standardize time context and tool timestamps 2026-01-15 22:27:06 +00:00
chunk.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
chunk.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
command-auth.test.ts fix: harden whatsapp command auth 2026-01-15 07:54:39 +00:00
command-auth.ts chore: format + fix telegram thread ids 2026-01-15 09:13:19 +00:00
command-detection.test.ts fix: normalize telegram command mentions 2026-01-11 21:06:04 +05:30
command-detection.ts fix: unblock control commands during active runs 2026-01-15 07:08:48 +00:00
commands-args.ts fix: lint errors 2026-01-15 17:08:31 +00:00
commands-registry.args.test.ts test: cover dynamic command arg menus 2026-01-15 10:25:35 +00:00
commands-registry.data.ts Commands: add dynamic arg menus 2026-01-15 09:31:16 +00:00
commands-registry.test.ts feat: extend Telegram dock commands and config hashing (#929) 2026-01-15 05:49:28 +00:00
commands-registry.ts fix: make node-llama-cpp optional 2026-01-15 18:37:02 +00:00
commands-registry.types.ts fix: tighten command arg value types 2026-01-15 17:08:09 +00:00
envelope.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
envelope.ts refactor!: rename chat providers to channels 2026-01-13 08:40:39 +00:00
group-activation.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
heartbeat.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
heartbeat.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
inbound-debounce.test.ts feat(whatsapp): add debounceMs for batching rapid messages (#971) 2026-01-15 23:07:19 +00:00
inbound-debounce.ts feat(whatsapp): add debounceMs for batching rapid messages (#971) 2026-01-15 23:07:19 +00:00
media-note.test.ts style: apply lint fixes 2026-01-08 04:44:15 +00:00
media-note.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
model.test.ts fix: support /models alias for /model 2026-01-09 06:24:40 +01:00
model.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.block-streaming.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.accepts-thinking-xhigh-codex-models.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.applies-inline-reasoning-mixed-messages-acks-immediately.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.defaults-think-low-reasoning-capable-models-no.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.ignores-inline-model-uses-default-model.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.lists-allowlisted-models-model-list.test.ts fix(model-picker): list each provider/model combo separately (#970) 2026-01-15 22:20:11 +00:00
reply.directive.directive-behavior.prefers-alias-matches-fuzzy-selection-is-ambiguous.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.requires-per-agent-allowlist-addition-global.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.returns-status-alongside-directive-only-acks.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.shows-current-elevated-level-as-off-after.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.shows-current-verbose-level-verbose-has-no.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.supports-fuzzy-model-matches-model-directive.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.updates-tool-verbose-during-flight-run-toggle.test.ts fix(model-picker): list each provider/model combo separately (#970) 2026-01-15 22:20:11 +00:00
reply.directive.parse.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.heartbeat-typing.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.media-note.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.queue.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.raw-body.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.group-intro-prompts.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.allows-activation-from-allowfrom-groups.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.allows-approved-sender-toggle-elevated-mode.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.allows-elevated-off-groups-without-mention.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.filters-usage-summary-current-model-provider.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.handles-inline-commands-strips-it-before-agent.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.ignores-inline-elevated-directive-unapproved-sender.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.includes-error-cause-embedded-agent-throws.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.keeps-inline-status-unauthorized-senders.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.reports-active-auth-profile-key-snippet-status.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.runs-compact-as-gated-command.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.runs-greeting-prompt-bare-reset.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.shows-endpoint-default-model-status-not-configured.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.shows-quick-model-picker-grouped-by-model.test.ts feat(whatsapp): add debounceMs for batching rapid messages (#971) 2026-01-15 23:07:19 +00:00
reply.triggers.trigger-handling.stages-inbound-media-into-sandbox-workspace.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.targets-active-session-native-stop.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.ts refactor(auto-reply): split reply pipeline 2026-01-14 09:11:16 +00:00
send-policy.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
status.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
status.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
templating.test.ts fix: make node-llama-cpp optional 2026-01-15 18:37:02 +00:00
templating.ts feat(whatsapp): add debounceMs for batching rapid messages (#971) 2026-01-15 23:07:19 +00:00
thinking.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
thinking.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
tokens.ts feat: add provider-specific tool policies 2026-01-15 03:55:20 +00:00
tool-meta.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
tool-meta.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
transcription.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
transcription.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
types.ts feat: add dynamic template variables to messages.responsePrefix (#923) 2026-01-14 23:05:08 -05:00