Skip to content

Agent loses context of owner's outbound messages in WhatsApp DM conversations #12480

@mactsk

Description

@mactsk

Description

When DM history is loaded for agent context, checkInboundAccessControl() blocks the gateway owner's own outbound messages (msg.key.fromMe === true). The agent only sees incoming messages from the contact, losing the owner's side of the conversation.

Result: The agent has incomplete conversation context in DMs and cannot provide coherent follow-up responses.

Expected Behavior

In DM conversations, the agent should have access to the full conversation history including:

  • Messages received from the contact
  • Messages sent by the gateway owner

Current Behavior

checkInboundAccessControl() evaluates outbound DMs against dmPolicy and allowFrom rules, which were designed for incoming messages. The owner's own outbound messages get blocked because the owner's number isn't in allowFrom (it doesn't need to be — they own the gateway).

Suggested Fix

In checkInboundAccessControl(), when a message is a DM (!params.group) and is from the owner (params.isFromMe === true), skip the dmPolicy/allowFrom filtering and allow it through:

// Before dmPolicy/allowFrom checks:
if (!params.group && params.isFromMe) {
    return { allowed: true, shouldMarkRead: false, isSelfChat, resolvedAccountId: account.accountId };
}

This could also be gated behind a config option like channels.whatsapp.includeOutbound: true.

Environment

  • OpenClaw 2026.2.2-3
  • WhatsApp channel
  • macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions