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
- buildInboundUserContextPrefix() in inbound-meta.ts generates metadata as separate user block
- drainFormattedSystemEvents() in session-system-events.ts formats system events as System: lines with ephemeral cache control, injected as another user block
- Neither is merged with the actual user message
Related issues
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
Root cause
Related issues