Skip to content

fix(whatsapp): silently drops inbound messages when more than 450 are waiting - #116179

Merged
vincentkoc merged 2 commits into
openclaw:mainfrom
yetval:fix/whatsapp-pending-ingress-retention
Jul 30, 2026
Merged

vincentkoc merged 2 commits into
openclaw:mainfrom
yetval:fix/whatsapp-pending-ingress-retention

Conversation

@yetval

@yetval yetval commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Related: #50563
Related: #85506

What Problem This Solves

WhatsApp durably accepts each inbound messages.upsert before agent dispatch, but its shared ingress monitor was configured to hard-delete pending rows after 30 days or above 450 entries.

Pending rows are accepted, undelivered work. The monitor prunes before its first claim, so a restart with 451 queued messages deleted the oldest message before dispatch. A pending row older than 30 days was deleted the same way. Both paths removed the payload and durable identity without a tombstone, failure record, or warning.

Why This Change Was Made

Remove only WhatsApp's pendingTtlMs and pendingMaxEntries overrides. Completed and failed replay guards remain bounded:

  • completed: 7-day TTL and 5,000 entries
  • failed: inherited 30-day TTL and 450 entries

This is the correct plugin-owner boundary. Shared core is enforcing an explicit pruning API, and all 20 sibling shared-monitor adapters omit pending retention. The fix does not add configuration, change the SQLite schema, or weaken terminal replay-guard retention.

The limits originated in the pre-specialized-ingress-queue WhatsApp durable receive journal backed by the generic SQLite plugin-state keyed store. PR #85506 introduced the 450-entry/30-day pending journal, b0679d1f13d carried those bounds into channel_ingress_events, and #115824 later inlined them. The predecessor was durable accepted work, not a pre-SQLite replay-guard cache.

User Impact

Accepted WhatsApp messages remain recoverable until dispatch, permanent failure, or explicit operator action. Backlogs above 450 and pending work older than 30 days no longer lose messages silently.

No migration or configuration change is required.

Evidence

The regression suite uses the production createWhatsAppIngressMonitor and the real SQLite-backed ingress queue.

Legacy limits restored:

  • 31-day pending row: 0 of 1 dispatched
  • 451 pending rows: 450 of 451 dispatched; msg-000 was deleted

Patched behavior:

  • 31-day pending row: 1 of 1 dispatched
  • 451 pending rows: 451 of 451 dispatched
  • completed and failed retention options remain bounded as listed above

Focused Testbox proof:

extensions/whatsapp/src/inbound/durable-receive.test.ts: 9 passed
src/channels/message/ingress-monitor.test.ts: 22 passed
src/channels/message/ingress-queue.test.ts: 30 passed
total: 61 passed

Additional proof:

  • pnpm check:changed: passed, including formatting, plugin/API boundaries, dead-code scans, extension and extension-test typechecks, lint, database-first guard, and import-cycle checks
  • fresh Codex autoreview: clean, no actionable findings, confidence 0.91
  • git diff --check: passed

Testing

  • Real SQLite + production WhatsApp monitor regression for the legacy 450-entry cap
  • Real SQLite + production WhatsApp monitor regression for the legacy 30-day TTL
  • Completed and failed replay-guard retention remains bounded
  • Focused WhatsApp and shared ingress tests on Blacksmith Testbox
  • Changed-file gates
  • Fresh autoreview
  • Exact-head hosted CI

… waiting

WhatsApp asked the shared ingress monitor to enforce a 450-entry cap and a
30-day TTL on pending durable ingress rows. Pending rows are undelivered work,
not history, and the monitor runs retention before its first claim, so an
account holding 451 accepted messages lost the oldest one to a hard DELETE
before it could ever be dispatched. Loss scaled linearly with backlog depth and
left no tombstone, no failure record, and no retained payload.

Drop pendingTtlMs and pendingMaxEntries from the WhatsApp retention config.
Completed and failed retention is unchanged so on-disk history stays bounded,
and the config now matches every other channel on the shared monitor, whose
defaults cover completed and failed only. The two values were carried over
mechanically from the pre-SQLite openKeyedStore replay-guard cache in
b0679d1 and inlined verbatim in openclaw#115824.

Add regression coverage driving the real monitor and the real SQLite ingress
queue over 451 accepted records.
@openclaw-barnacle openclaw-barnacle Bot added channel: whatsapp-web Channel integration: whatsapp-web size: XS labels Jul 30, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. labels Jul 30, 2026
@clawsweeper

clawsweeper Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 29, 2026, 11:55 PM ET / July 30, 2026, 03:55 UTC.

ClawSweeper review

What this changes

The branch removes WhatsApp’s 30-day/450-entry retention limits for pending durable inbound messages and adds regression coverage for 31-day-old and 451-message backlogs.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for normal maintainer review. The focused change removes a documented silent-loss path for accepted WhatsApp work, preserves bounded retention for terminal states, and the supplied Testbox evidence exercises the production monitor against SQLite; the remaining gate is refresh against current main and completion of exact-head CI.

Priority: P1
Reviewed head: f259f4d4970ec54061091fcc9f20d957b24575eb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-aligned repair with concrete SQLite monitor proof; exact-head CI and merge refresh remain the appropriate final landing checks.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body provides after-fix Testbox terminal results for the production WhatsApp monitor using a real SQLite-backed ingress queue, including the observed 451-of-451 and aged-pending dispatch outcomes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides after-fix Testbox terminal results for the production WhatsApp monitor using a real SQLite-backed ingress queue, including the observed 451-of-451 and aged-pending dispatch outcomes.
Evidence reviewed 4 items Changed retention boundary: At the PR head, the WhatsApp monitor retains its explicit completed and failed bounds while no longer supplies pending TTL or max-entry overrides, so accepted work reaches the shared monitor without a deletion policy for the pending state.
Regression coverage: The PR adds production-monitor tests using the SQLite-backed ingress test queue for a pending record older than 30 days and for 451 accepted pending records, covering both deleted-before-claim mechanisms described in the PR.
Feature provenance: The supplied related-item history shows durable WhatsApp inbound delivery was introduced by merged #85506, while merged #115824 preserved WhatsApp’s distinct pending-retention tuple during the shared-monitor refactor. This PR narrowly corrects that retained policy.
Findings None None.
Security None None.

How this fits together

WhatsApp stores accepted inbound messages in the shared durable channel-ingress queue before agent dispatch. The ingress monitor claims those pending rows for delivery and separately prunes completed or failed replay-guard history.

flowchart LR
  A[WhatsApp inbound message] --> B[Durable ingress queue]
  B --> C[Pending accepted work]
  C --> D[Ingress monitor]
  D --> E[Agent dispatch]
  E --> F[Completed or failed record]
  F --> G[Bounded terminal retention]
Loading

Before merge

  • Resolve merge risk (P1) - The PR is reported mergeable but behind the supplied current main SHA, and several exact-head hosted checks remain in progress; refresh the merge result and use the final exact-head CI before landing.
  • Complete next step (P2) - No discrete repair is indicated; this PR needs ordinary maintainer landing checks on the current merge result rather than an automated fix lane.
Agent review details

Security

None.

PR surface

Source -2, Tests +106. Total +104 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 0 2 -2
Tests 1 107 1 +106
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 107 3 +104

Review metrics

None.

Stored data model

Persistent data-model change detected: persistent cache schema: extensions/whatsapp/src/inbound/durable-receive.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the narrow plugin-owned change once rebased or merge-refreshed against current main with exact-head CI green, so accepted WhatsApp messages remain durable until dispatch or a recorded terminal outcome.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the narrow plugin-owned change once rebased or merge-refreshed against current main with exact-head CI green, so accepted WhatsApp messages remain durable until dispatch or a recorded terminal outcome.

Do we have a high-confidence way to reproduce the issue?

No independent current-main run was available in this read-only review, but the reported loss mechanism is source-reproducible through the production ingress monitor and SQLite-backed queue tests added here.

Is this the best way to solve the issue?

Yes. Removing only the WhatsApp pending-retention overrides fixes the owner-local deletion policy while retaining bounded completed and failed replay-guard history; an arbitrary pending cap would again delete accepted work.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against cc48aef14355.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: The corrected behavior prevents silently deleting accepted inbound WhatsApp messages when a backlog exceeds 450 rows or remains pending beyond 30 days.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides after-fix Testbox terminal results for the production WhatsApp monitor using a real SQLite-backed ingress queue, including the observed 451-of-451 and aged-pending dispatch outcomes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix Testbox terminal results for the production WhatsApp monitor using a real SQLite-backed ingress queue, including the observed 451-of-451 and aged-pending dispatch outcomes.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the merged WhatsApp durable-inbound implementation and the subsequent shared ingress-retention refactor that preserved the WhatsApp-specific tuple this PR changes. (role: durable-ingress feature author and recent area contributor; confidence: high; commits: b47bace01423, 986e5d175861; files: extensions/whatsapp/src/inbound/durable-receive.ts, src/channels/message/ingress-monitor.ts)
  • vincentkoc: Authored the current PR’s follow-up regression-test commit and is assigned to the PR, making them a relevant routing contact for the verification coverage. (role: recent area contributor; confidence: medium; commits: f259f4d4970e; files: extensions/whatsapp/src/inbound/durable-receive.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh the merge result against current main and wait for the in-progress exact-head hosted checks before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-07-30T02:31:40.568Z sha 81c46bf :: needs maintainer review before merge. :: none
  • reviewed 2026-07-30T02:42:00.079Z sha 81c46bf :: needs maintainer review before merge. :: none

@yetval
yetval marked this pull request as ready for review July 30, 2026 02:37
@vincentkoc vincentkoc self-assigned this Jul 30, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Jul 30, 2026
@vincentkoc
vincentkoc merged commit 4e5bf66 into openclaw:main Jul 30, 2026
127 of 131 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 30, 2026
… waiting (openclaw#116179)

* fix(whatsapp): silently drops inbound messages when more than 450 are waiting

WhatsApp asked the shared ingress monitor to enforce a 450-entry cap and a
30-day TTL on pending durable ingress rows. Pending rows are undelivered work,
not history, and the monitor runs retention before its first claim, so an
account holding 451 accepted messages lost the oldest one to a hard DELETE
before it could ever be dispatched. Loss scaled linearly with backlog depth and
left no tombstone, no failure record, and no retained payload.

Drop pendingTtlMs and pendingMaxEntries from the WhatsApp retention config.
Completed and failed retention is unchanged so on-disk history stays bounded,
and the config now matches every other channel on the shared monitor, whose
defaults cover completed and failed only. The two values were carried over
mechanically from the pre-SQLite openKeyedStore replay-guard cache in
4095b1e and inlined verbatim in openclaw#115824.

Add regression coverage driving the real monitor and the real SQLite ingress
queue over 451 accepted records.

* test(whatsapp): cover pending ingress retention

---------

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: whatsapp-web Channel integration: whatsapp-web P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants