#23164: fix: suppress narration text when assistant message contains tool calls
agents
size: M
Cluster:
Tool Result Handling Improvements
## Problem
When an assistant message contains tool calls, any preceding text blocks (e.g. "Let me search for that information.") are narration that leaks to the user chat channel as delivered messages instead of being suppressed.
Reported in #17154. Related PRs: #20052, #15864, #19932.
## Fix
Three delivery paths are addressed:
1. **Final payload path** (payloads.ts): splice narration from assistantTexts in handleMessageEnd before the embedded runner builds reply items.
2. **Block reply (message_end break)**: guard onBlockReply emission with a messageHasToolCall check so narration is never sent as a block reply.
3. **Block reply (text_end break)**: guard chunker drain and buffer flush at text_end by checking if the partial message already contains toolCall content blocks, suppressing narration in streaming mode when providers include tool blocks eagerly.
### Limitation
For providers that do not include toolCall blocks in the partial message before text_end fires, narration may still stream briefly in text_end break mode. The handleMessageEnd splice ensures it is always excluded from the final delivered payload regardless.
## Tests
9 test cases covering narration removal, text preservation, baseline-aware splicing, onBlockReply suppression, text_end streaming suppression, and resolveSilentReplyFallbackText behavior.
Closes #17154
Most Similar PRs
#20052: fix(agents): suppress narration text when assistant message has too...
by lailoo · 2026-02-18
84.8%
#19518: fix: await block reply flush before tool execution
by katalabut · 2026-02-17
69.7%
#16275: fix(agents): prevent rapid-fire duplicate messages during tool exec...
by heyhudson · 2026-02-14
65.6%
#18935: fix(agents): suppress reasoning blocks from channel delivery
by BinHPdev · 2026-02-17
65.4%
#16966: fix: strip tool_use blocks from aborted/errored assistant messages
by StressTestor · 2026-02-15
65.2%
#19932: feat(agents): suppressPreToolText config + onBlockReply buffering
by Milofax · 2026-02-18
65.0%
#19235: fix(telegram): tool error warnings no longer overwrite streamed rep...
by gatewaybuddy · 2026-02-17
64.7%
#9171: Fix: Route tool result deliveries through BlockReplyPipeline for pr...
by vishaltandale00 · 2026-02-04
63.7%
#10996: fix(control-ui): hide tool call blocks when thinking/working toggle...
by Annaxiebot · 2026-02-07
63.4%
#22087: Preserve assistant reply when exec fails under suppressToolErrors
by graysurf · 2026-02-20
63.4%