Bug type
Behavior bug (incorrect output/state without crash)
Summary
When the agent produces multiple independent final replies (replies=2) in a single request, the Feishu streaming card incorrectly merges content from the second reply into the first card, while also sending the second reply as a separate card. This results in duplicate content being displayed to the user.
Steps to reproduce
- Agent received a request to create a calendar meeting
- Agent produced two independent replies:
- First reply: "让我先读取一下日历工具的使用说明..." followed by meeting details
- Second reply: Just the meeting details
Expected behavior
When agent produces multiple independent replies, each should be delivered as a separate message, OR they should be properly merged into a single coherent message without duplication.
Actual behavior
User received two Feishu messages:
- First message: Contains both the first reply AND the second reply content (merged)
- Second message: Contains only the second reply content
The content is duplicated across messages
OpenClaw version
2026.3.8
Operating system
Ubuntu 24.04
Install method
npm global
Model
zai/glm-5
Provider / routing chain
openclaw -> zai
Config file / key location
No response
Additional provider/model setup details
No response
Logs, screenshots, and evidence
## Evidence from logs
Mar 12 12:01:27 Started streaming: cardId=7616214340648340671, messageId=om_x100b5417e74b60a4c3a474e9be9dc4f
Mar 12 12:02:10 Closed streaming: cardId=7616214340648340671
Mar 12 12:02:10 Started streaming: cardId=7616214523998375126, messageId=om_x100b5417e2e3907cc2906e393e5ae37
Mar 12 12:02:11 Closed streaming: cardId=7616214523998375126
Mar 12 12:02:11 dispatch complete (queuedFinal=true, replies=2)
Two different cardIds were created, but the first card contained content from both replies.
## Root cause analysis
Looking at the `mergeStreamingText` function in `extensions/feishu/src/streaming-card.ts`:
export function mergeStreamingText(
previousText: string | undefined,
nextText: string | undefined,
): string {
// ... various merge attempts ...
// Fallback for fragmented partial chunks: append as-is to avoid losing tokens.
return `${previous}${next}`; // ← This causes unrelated content to be merged
}
When two replies have completely different content (no overlap), the fallback behavior is to concatenate them. This is intended for partial streaming chunks, but incorrectly merges unrelated final replies.
## Suggested fix
1. Track whether streaming session has received a final delivery
2. If a new final reply arrives after a previous final was already delivered, start a new streaming card instead of merging
3. Or: Modify `mergeStreamingText` to have a "strict" mode that refuses to merge completely unrelated content
Impact and severity
No response
Additional information
No response
Bug type
Behavior bug (incorrect output/state without crash)
Summary
When the agent produces multiple independent final replies (
replies=2) in a single request, the Feishu streaming card incorrectly merges content from the second reply into the first card, while also sending the second reply as a separate card. This results in duplicate content being displayed to the user.Steps to reproduce
Expected behavior
When agent produces multiple independent replies, each should be delivered as a separate message, OR they should be properly merged into a single coherent message without duplication.
Actual behavior
User received two Feishu messages:
The content is duplicated across messages
OpenClaw version
2026.3.8
Operating system
Ubuntu 24.04
Install method
npm global
Model
zai/glm-5
Provider / routing chain
openclaw -> zai
Config file / key location
No response
Additional provider/model setup details
No response
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response