#18187: fix: tool summaries silently dropped when reasoningLevel is stream
docs
channel: discord
channel: telegram
agents
stale
size: M
Cluster:
Tool Result Handling Improvements
## Problem
When `reasoningLevel` is set to `"stream"`, all successful tool summary messages (e.g. `🔧 Exec: ...`) are silently dropped and never delivered to the user. Failed tool messages (with ⚠️) are unaffected.
## Root Cause
In `agent-runner-execution.ts`, the `onToolResult` callback uses `normalizeStreamingText()` to process tool summaries. This function checks `allowPartialStream`, which is `false` when `reasoningLevel === "stream"` and `onReasoningStream` is present:
```typescript
const allowPartialStream = !(
params.followupRun.run.reasoningLevel === "stream" && params.opts?.onReasoningStream
);
```
When `allowPartialStream` is false, `normalizeStreamingText` returns `{ skip: true }` immediately, causing all tool summaries to be discarded.
## Fix
Bypass `normalizeStreamingText` in the `onToolResult` callback and apply only the lightweight sanitization that tool summaries actually need (`isSilentReplyText` check + `sanitizeUserFacingText`). Tool summaries are not streaming text and should not be gated by `allowPartialStream`.
## Testing
- Verified tool summaries now appear in Telegram when `reasoningLevel: stream`
- Failed tool messages continue to work as before
- No impact on partial streaming text behavior
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR fixes tool summaries being silently dropped when `reasoningLevel` is `"stream"` by bypassing `normalizeStreamingText` in the `onToolResult` callback. The fix correctly applies only the lightweight sanitization needed for tool summaries (`isSilentReplyText` check and `sanitizeUserFacingText`) instead of the full streaming text normalization.
However, this PR bundles multiple unrelated features beyond the stated fix:
- Telegram reasoning buffer to send reasoning before main text
- Discord proxy support for media downloads (`channels.discord.proxy`)
- Reply dispatcher timeout mechanism (30s default)
- Groq audio transcription curl fallback for 403 errors
- Discord handler refactoring and type improvements
The core tool summary fix is sound, but bundling multiple features in a single PR makes review, testing, and potential rollback more difficult. Consider splitting these into separate PRs in the future.
<h3>Confidence Score: 4/5</h3>
- This PR is reasonably safe to merge with moderate risk from scope creep
- The core fix for tool summaries is correct and well-reasoned. However, the PR bundles multiple unrelated features (Telegram reasoning buffer, Discord proxy, reply timeout, Groq fallback) which increases complexity and testing surface area. The changes are well-implemented individually but would benefit from being split into separate PRs. Previous review threads identified issues that have not been addressed in this PR.
- Pay close attention to `src/auto-reply/reply/reply-dispatcher.ts` (timeout implementation) and `src/telegram/bot-message-dispatch.ts` (reasoning buffer logic)
<sub>Last reviewed commit: edc7b33</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#19235: fix(telegram): tool error warnings no longer overwrite streamed rep...
by gatewaybuddy · 2026-02-17
84.1%
#19399: telegram: fix MEDIA false positives and partial final drop
by HOYALIM · 2026-02-17
83.7%
#19375: telegram: align tool-error summaries
by NorthyIE · 2026-02-17
81.1%
#15996: fix(agents): messages arrive out of order — tool output beats narra...
by yinghaosang · 2026-02-14
80.1%
#9171: Fix: Route tool result deliveries through BlockReplyPipeline for pr...
by vishaltandale00 · 2026-02-04
79.9%
#8753: fix(telegram): add config option to disable acknowledgments
by revenuestack · 2026-02-04
79.7%
#15050: fix: transcript corruption resilience — strip aborted tool_use bloc...
by yashchitneni · 2026-02-12
79.6%
#2805: fix: wire onToolResult to dispatcher for verbose tool summaries
by LinghaoZhuang · 2026-01-27
79.4%
#19673: fix(telegram): avoid starting streaming replies with only 1-2 words
by emanuelst · 2026-02-18
79.4%
#8353: fix(ui): display tool calls during webchat streaming
by MarvinDontPanic · 2026-02-03
79.3%