Skip to content

Bug: TUI displays injected message metadata ("Conversation info (untrusted metadata)") in chat history #21109

@nhod

Description

@nhod

Summary

The TUI renders raw stored session message content, which includes injected "Conversation info (untrusted metadata)" blocks prepended to every user message. These blocks are meant to be invisible AI context, not user-visible UI elements.

Root Cause

Message context injection (in pi-embedded-*.js) prepends metadata blocks directly to the message content before storage in the session JSONL:

Conversation info (untrusted metadata):
```json
{
  "message_id": "...",
  "sender": "gateway-client"
}
\```

\```

The TUI loads session history via `chat.history` and renders the raw stored content without stripping these injected blocks. There is no filtering/stripping logic in the TUI render path, and no config option to suppress the metadata injection.

## Reproduction

1. Open the TUI: `openclaw tui`
2. Send any message
3. The message appears in the TUI chat history prefixed with a `Conversation info (untrusted metadata):` JSON block

## Expected

Metadata injection blocks are invisible to the user in all UI surfaces.

## Actual

Every user message in the TUI is prefixed with:

Conversation info (untrusted metadata):

{ "message_id": "...", "sender": "..." }
\```

Workaround

None. Using Telegram or WhatsApp as the channel avoids the issue since those channel UIs render only the bot response, not the raw stored session content.

Suggested Fix

The TUI message renderer should strip known metadata injection prefixes before display. Alternatively, the injection should happen ephemerally at model-call time rather than being persisted to the session JSONL store.

Environment

  • OS: macOS 26.3 (Sequoia), Apple Silicon
  • OpenClaw: 2026.2.17
  • Node: v25.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    dedupe:parentPrimary canonical item in dedupe cluster

    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