openclaw - 💡(How to fix) Fix [Bug]: Feishu DM Conversation info metadata injected as separate user block causes model to treat metadata as greeting message

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

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.

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

Code Example

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

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

  • #83419 - Group chat context injection (same root cause)
  • #82337 - Strip inbound metadata from past turns
  • #81241 - Telegram: runtime-context envelope leak
  • #88077 - Active Memory recall context envelope issue

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: Feishu DM Conversation info metadata injected as separate user block causes model to treat metadata as greeting message