Skip to content

[Bug]: Feishu DM Conversation info metadata injected as separate user block causes model to treat metadata as greeting message #88261

Description

@oom2018

Summary

Feishu direct messages inject metadata as two extra user-role blocks separate from the actual message text, causing 3 consecutive user messages per turn.

This breaks role alternation (Anthropic API rejects 400) and confuses OpenAI-compatible APIs. The model sees metadata blocks as user input and responds to them instead of the real message.

Actual payload (anonymized)

[
  {"role": "user", "content": "Conversation info (untrusted metadata): {sender details}"},
  {"role": "user", "content": "System: [timestamp] Feishu[main] DM | User [msg:id]", "cache_control": {"type": "ephemeral"}}
]

Key issue

Metadata blocks appear as separate user messages. When system events flush (heartbeat, cron), the model sees metadata as the freshest user input and responds with unrelated greetings instead of answering the real question.

OpenClaw version

2026.5.22 (a374c3a)

Environment

  • OS: Linux (Docker, Ubuntu 24.04, x64)
  • Channel: Feishu DM (websocket)
  • Model: Claude-Opus-4.6/DeepSeek-V4-Pro

Root cause

  1. buildInboundUserContextPrefix() in inbound-meta.ts generates metadata as separate user block
  2. drainFormattedSystemEvents() in session-system-events.ts formats system events as System: lines with ephemeral cache control, injected as another user block
  3. Neither is merged with the actual user message

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions