-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
MSTeams: streaming reply drops during long tool chains (30s+) #59731
Copy link
Copy link
Open
Description
Summary
Streaming 1:1 replies (added in PR #51808) work great for short conversational exchanges, but the final reply is dropped when an agent performs a long tool chain (3+ sequential tool calls spanning 30+ seconds).
Environment
- OpenClaw v2026.4.1
- Microsoft Teams plugin (bundled)
- Single-tenant bot registration
- DM (1:1) conversation
Steps to Reproduce
- User sends a message that triggers multiple sequential tool calls
- Agent begins streaming reply — initial text appears in Teams
- Agent executes 4 sequential
exectool calls with 10-20 second delays each (~60 seconds total) - Agent completes tool chain and writes final reply text
Expected Behavior
- Streaming card should continue updating during tool execution (e.g., showing status updates)
- Final reply text should appear in Teams after all tool calls complete
Actual Behavior
- Streaming card shows initial pre-tool text correctly
- Card freezes during tool execution — no updates visible
- Final reply after tool chain (~60 seconds later) is silently dropped
- User only sees the partial initial text
Analysis
The Bot Framework TurnContext proxy still expires after ~30 seconds even with streaming enabled. Short replies work because the streaming card finishes before the proxy timeout. Long tool chains exceed this window.
Possible approaches:
- Heartbeat updates during tool execution — Send periodic
updateActivitycalls to the streaming card during tool calls to keep the TurnContext alive (e.g., "Running command 2/4...") - Proactive fallback — Detect when a turn exceeds a threshold and automatically switch to proactive message delivery (using stored conversation references) for the final reply
- Tool-aware streaming — Emit streaming card updates at tool boundaries (tool start/complete events) to maintain the connection
Workaround
We currently use a hybrid approach:
- Turn-context (streaming) for simple replies with no tools or quick tools (< 15 seconds)
- Proactive
messagetool sends for replies after long tool chains (30+ seconds)
This works but requires agent-side awareness of delivery rules, which is fragile and adds complexity to the system prompt.
Related
- PR msteams: implement Teams AI agent UX best practices #51808 — Original Teams SDK migration with streaming support
- The Feishu channel handles a similar pattern with streaming card transport that persists across tool calls
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.