Skip to content

TUI renders inbound metadata block in user messages #22276

@joeyfrasier

Description

@joeyfrasier

Bug

The TUI's UserMessageComponent renders the full message text including the Conversation info (untrusted metadata): JSON block that is prepended by inbound-meta.ts. This metadata is intended for the model only and should not be visible to the user.

Steps to Reproduce

  1. Open the TUI (openclaw tui)
  2. Send any message
  3. Observe the rendered user message includes the metadata block:
Conversation info (untrusted metadata):
\`\`\`json
{"message_id": "...", "sender_id": "...", "sender": "..."}
\`\`\`

Expected Behavior

The metadata block should be stripped before rendering in the TUI. The user should only see their own message text.

Root Cause

src/tui/components/user-message.ts renders raw message text without stripping the metadata injected by src/auto-reply/reply/inbound-meta.ts.

Suggested Fix

Strip text matching the Conversation info (untrusted metadata): pattern (and the surrounding code fence) before passing to UserMessageComponent. Could be done in:

  • The TUI event handler that creates UserMessageComponent
  • Or a shared utility that strips known metadata patterns

Environment

  • OpenClaw source: ~/dev/openclaw
  • Channel: webchat (TUI)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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