#19798: fix(reply-dispatcher): add parallel blockChain for real-time block streaming
size: XS
Cluster:
Tool Result Handling Improvements
## Summary
This PR adds parallel blockChain support to enable real-time LLM output streaming in Matrix channels while tools are executing.
## Problem
Previously, block replies (LLM streaming output) were queued behind tool results in a single serial chain. This meant users in Matrix channels couldn't see LLM-generated text until all tool execution completed.
## Solution
Add a separate blockChain in reply-dispatcher.ts that allows block replies to be delivered in parallel with tool execution, while preserving the serial ordering for tool results and final replies.
## Changes
| File | Change |
|------|--------|
| src/auto-reply/reply/reply-dispatcher.ts | Add parallel blockChain for block replies; update waitForIdle() to wait for both chains |
## How It Works
- Block replies now have their own delivery chain that runs in parallel with the main chain
- Tool results and final replies still use the main serial chain (preserves ordering)
- waitForIdle() now waits for both chains to complete
- Block streaming behavior remains config-controlled (no default behavior change)
## Testing
- [x] Code reviewed and tested
## AI-Assisted
Most Similar PRs
#19981: feat(matrix): enable block streaming
by alberthild · 2026-02-18
67.4%
#16275: fix(agents): prevent rapid-fire duplicate messages during tool exec...
by heyhudson · 2026-02-14
63.8%
#11608: feat(slack): native streaming, Block Kit blocks, tool-aware status
by joshdavisind · 2026-02-08
61.5%
#19518: fix: await block reply flush before tool execution
by katalabut · 2026-02-17
61.4%
#9171: Fix: Route tool result deliveries through BlockReplyPipeline for pr...
by vishaltandale00 · 2026-02-04
59.8%
#15920: fix: await coalescer flush before tool execution
by Bridgerz · 2026-02-14
59.7%
#5080: fix(reply): fix duplicate block replies by unblocking coalesced pay...
by yassine20011 · 2026-01-31
59.3%
#19274: feat(mattermost): enable threaded replies in channels
by rockinyp · 2026-02-17
58.7%
#19141: fix(telegram): serialize per-chat sends and await block reply flush...
by botverse · 2026-02-17
58.6%
#22886: fix: await onBlockReplyFlush before tool execution to preserve mess...
by botverse · 2026-02-21
58.2%