← Back to PRs

#23164: fix: suppress narration text when assistant message contains tool calls

by ahdernasr open 2026-02-22 02:43 View on GitHub →
agents size: M
## 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