Skip to content

Include participant identity and quoted reply context in gateway inbound log #63589

@2vanm

Description

@2vanm

Problem

When WhatsApp group messages are logged by the gateway, the inboundLogger.info() call only writes {from, to, body, timestamp} to the log file. The from field is the group JID, so there is no way to identify which participant sent the message. Quoted reply context (the message being replied to) is also absent.

This matters for any downstream processing of group messages outside of a live session — for example, a cron job that extracts group messages from the log to monitor a family WhatsApp group for itinerary changes.

Current behaviour

The gateway's enqueueInboundMessage() already builds a rich inboundMessage object with:

  • senderJid, senderE164, senderName — participant identity
  • replyToId — stanza ID of the quoted message
  • replyToBody — text of the quoted message
  • replyToSender, replyToSenderJid, replyToSenderE164 — who was quoted

For messages that reach the agent (pass mention gating), this data is formatted beautifully into the message body — [Replying to <sender>] <quoted body> [/Replying] and [from: Sender Name (+E164)]. This works perfectly.

But the inboundLogger.info() call discards all of this:

inboundLogger.info({
    from: inbound.from,        // group JID, not participant
    to: self.e164 ?? "me",
    body: enriched.body,
    mediaPath, mediaType, mediaFileName,
    timestamp
}, "inbound message");

Requested change

Include participant identity and reply context fields in the logged object:

inboundLogger.info({
    from: inbound.from,
    to: self.e164 ?? "me",
    body: enriched.body,
    senderJid: inbound.senderJid,
    senderE164: inbound.senderE164,
    senderName: inbound.senderName,
    replyToId: enriched.replyContext?.replyToId,
    replyToBody: enriched.replyContext?.replyToBody,
    replyToSender: enriched.replyContext?.replyToSender,
    mediaPath, mediaType, mediaFileName,
    timestamp
}, "inbound message");

This is a minimal change — the data is already computed, it just needs to be included in the log line.

Use case

I have a cron job that monitors a family holiday WhatsApp group (with requireMention: true) by parsing the gateway log. Messages filtered by mention gating are still logged, which is great — but without participant identity, I can't tell who said what, and without quoted reply context, I can't follow threaded conversations like:

  1. Ivan: "Can you book the osteopath?"
  2. Gia (quoting Ivan): "Yes, 4:30pm available"
  3. Ivan (quoting Gia): "Great, let's book it"

Currently this appears as three anonymous messages with no threading.

Environment

  • OpenClaw v2026.4.8
  • WhatsApp channel with groupPolicy: "open", group-level requireMention: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for 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:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions