Skip to content

WhatsApp replies silently dropped — routeReplyRuntime never loaded when originatingChannel === currentSurface #90214

Closed as not planned

Description

@WilBGit

Bug Description

Agent replies to WhatsApp are silently dropped. The reply is generated by the LLM but never dispatched to the WhatsApp channel. pendingFinalDelivery stays True indefinitely.

Root Cause

In dispatch-Bgs9vXV4.js (compiled), the condition at ~line 842 that decides whether to load the route-reply runtime:

const routeReplyRuntime = Boolean(
  !suppressAcpChildUserDelivery && 
  !isInternalWebchatTurn && 
  normalizedRouteReplyChannel && 
  replyRoute.to && 
  normalizedRouteReplyChannel !== normalizedCurrentSurface  // ← BUG
) ? await loadRouteReplyRuntime() : void 0;

When a WhatsApp session processes a reply:

  • normalizedRouteReplyChannel = "whatsapp" (from session delivery context)
  • normalizedCurrentSurface = "whatsapp" (from ctx.Provider / ctx.Surface)

Since "whatsapp" !== "whatsapp" is false, routeReplyRuntime is never loaded.

Downstream at line 110:

const shouldRouteToOriginating = Boolean(
  !params.suppressDirectUserDelivery &&
  !isInternalWebchatTurn &&
  params.isRoutableChannel(originatingChannel) &&  // ← () => false because no runtime
  params.originatingTo &&
  originatingChannel !== currentSurface
);

Without the runtime, isRoutableChannel() returns () => false, so shouldRouteToOriginating = false.

At line 867:

if (!shouldRouteToOriginating || !routeReplyChannel || !routeReplyTo || !routeReplyRuntime) return null;

routeReplyToOriginating() returns null, so the reply falls through to dispatcher.sendFinalReply() which sends to the internal webchat channel — not WhatsApp. The message is silently dropped from the user perspective.

Why This Happens

The gateway assumes that if originatingChannel === currentSurface, it is already "on" that channel and does not need to dispatch. But the gateway is always internal — it is never "on" the WhatsApp channel. It must actively load the WhatsApp runtime and dispatch outbound messages through it.

Impact

All OpenClaw users with WhatsApp (and likely Telegram, Signal, etc.) direct sessions will never receive agent replies. The messages appear in the webchat UI but are never delivered to the external channel.

Environment

  • OpenClaw: 2026.6.1 (2e08f0f)
  • Node: v25.8.1
  • Platform: macOS (arm64)
  • WhatsApp channel: @openclaw/whatsapp

Workaround

Patched the condition to also load the runtime for non-webchat channels:

|| (normalizedRouteReplyChannel && normalizedRouteReplyChannel !== "webchat")

This works but is a patch on compiled/minified code and will be lost on updates.

Suggested Fix

In the source code, the route-reply runtime loading condition should load the runtime whenever there is a routable external channel, regardless of whether it matches the current surface. The gateway should always explicitly dispatch to external channels — it cannot assume it is already "on" them.

Activity

  1. clawsweeper commented on Jun 4, 2026

    @clawsweeper
    Contributor

    Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

    Close as duplicate: the current code and latest release still contain the same-surface route-reply guard, but the remaining origin-delivery policy and fix are already tracked by the open canonical issue at #54531. This WhatsApp report adds useful concrete evidence, but it does not need to stay open as a second tracker.

    Root-cause cluster
    Relationship: duplicate
    Canonical: #54531
    Summary: This issue is a concrete WhatsApp same-surface manifestation of the broader open origin-delivery routing problem tracked by the canonical issue.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    Canonical path: Keep #54531 as the canonical origin-delivery decision and preserve this WhatsApp evidence there rather than tracking a second issue.

    So I’m closing this here and keeping the remaining discussion on #54531.

    Review details

    Best possible solution:

    Keep #54531 as the canonical origin-delivery decision and preserve this WhatsApp evidence there rather than tracking a second issue.

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

    Yes for source-level reproduction: current main still blocks route-reply runtime and origin routing when the originating channel equals the current surface. I did not run a live WhatsApp current-main reproduction in this read-only review.

    Is this the best way to solve the issue?

    No as a standalone tracker: the best fix belongs on the canonical origin-delivery issue because current tests and WhatsApp durable delivery paths make this a product and routing-boundary decision.

    Security review:

    Security review: No patch is under review; routing privacy and product policy should be handled on the canonical issue.

    AGENTS.md: found and applied where relevant.

    What I checked:

    Likely related people:

    • jalehman: Commit 2d67ec5 introduced the cross-provider-only route-reply rule requiring origin and current surface to differ. (role: introduced routing behavior; confidence: high; commits: 2d67ec5bfa27; files: src/auto-reply/reply/dispatch-from-config.ts)
    • steipete: The same routing commit was committed by Peter Steinberger, making this a useful routing-history contact for the same-provider dispatcher decision. (role: committer of routing behavior; confidence: medium; commits: 2d67ec5bfa27; files: src/auto-reply/reply/dispatch-from-config.ts)
    • mcaxtr: PR fix(auto-reply): count message tool sends as delivery #90123 touched WhatsApp inbound dispatch and auto-reply delivery accounting near the reported message-tool workaround path. (role: adjacent message-delivery contributor; confidence: medium; commits: 88dc177afc29; files: extensions/whatsapp/src/auto-reply/monitor/inbound-dispatch.ts, src/auto-reply/reply/dispatch-from-config.ts)
    • amknight: PR fix(auto-reply): clear pending-final state before honoring post-send abort (#89115) #93201 recently changed pendingFinalDelivery cleanup in dispatch-from-config, overlapping the stuck pending-final symptom. (role: recent pending-final contributor; confidence: medium; commits: eab22a911a2d; files: src/auto-reply/reply/dispatch-from-config.ts)

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

  2. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    on Jun 4, 2026
  3. soymarketing commented on Jun 4, 2026

    @soymarketing

    Confirming this on 2026.6.2-beta.1 (Raspberry Pi, WhatsApp via Baileys, codex/gpt-5.5).

    Repro / data point: A WhatsApp group agent that replies with plain final text (auto-delivery) is silently dropped — inbound received, agent runs, reply text produced, but zero outbound and nothing queued. DMs from the same agent deliver fine — but only because in DMs the agent also calls message(action="send"), which takes a different dispatch path. This lines up with the root cause here: the broken path is the auto-delivered route-reply (originatingChannel === currentSurface for WhatsApp), while the explicit message-tool send is unaffected.

    Workaround that fully restores group delivery: instruct the agent to deliver group replies via message(action="send", to="<jid>", message=...) and end the turn with NO_REPLY, instead of relying on plain-text auto-delivery. One clean send, no duplicate.

    Regression timeline on our side: last working group auto-reply was on the prior version; it broke immediately after updating to 2026.6.2-beta.1.

  4. added
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    and removed
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    on Jun 15, 2026
  5. openclaw-barnacle commented on Jul 6, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  6. openclaw-barnacle commented on Jul 6, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  7. locked as resolved and limited conversation to collaborators on Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions