Skip to content

Inbound message envelope header truncates message body, causing model confusion #67503

Description

@jaredgalloway

Summary

The inbound message envelope format includes the message body twice:

  1. In the System: header line (truncated to 160 chars)
  2. In full after the metadata blocks

This causes the model to sometimes reference the truncated header instead of the full message, leading to incorrect responses like "your message got cut off at 'day o'" when the full message was actually delivered.

Example

System: [2026-04-15 21:56:40 MDT] Slack DM from Jared: What I'm saying is that you are can handle this task (you just showed me you can), but starting tomorrow (and including tomorrow), When we're planning the day o

Conversation info (untrusted metadata):
...

What I'm saying is that you are can handle this task (you just showed me you can), but starting tomorrow (and including tomorrow), When we're planning the day of tasks, this one will be delegated to you. To complete it you'll search available times...

Note: "day o" in header vs "day of tasks" in full body.

Root Cause

Found in extensions/slack/src/monitor/message-handler/prepare.ts lines ~610-622:

const preview = rawBody.replace(/\s+/g, " ").slice(0, 160);
const inboundLabel = isDirectMessage
  ? `Slack DM from ${senderName}`
  : `Slack message in ${roomLabel} from ${senderName}`;

enqueueSystemEvent(`${inboundLabel}: ${preview}`, {
  sessionKey,
  contextKey: `slack:message:${message.channel}:${message.ts ?? "unknown"}`,
});

The system event enqueues a truncated preview (160 chars) into the event queue, which appears in the System: header. The full message body is delivered separately in the user turn.

Same pattern exists in:

  • extensions/msteams/src/monitor-handler/message-handler.ts (~line 494)
  • extensions/mattermost/src/mattermost/monitor.ts (~line 1375)

Proposed Fix

Remove the message content from the system event entirely. The system event's purpose is notification ("a message arrived"), not content delivery.

Before:

enqueueSystemEvent(`${inboundLabel}: ${preview}`, { ... });

After:

enqueueSystemEvent(inboundLabel, { ... });

This eliminates the duplicate/truncated content while preserving the notification functionality.

Impact

  • Model may quote truncated text back to users
  • Users think their messages are being cut off
  • Erodes trust in the system

Environment

  • OpenClaw version: OpenClaw 2026.4.14 (323493f)
  • Channel: Slack (also affects MS Teams, Mattermost)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.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:message-lossChannel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.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