mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 01:38:26 +00:00
fix(agents): await block-reply flush before tool execution starts
handleToolExecutionStart() flushed pending block replies and then called onBlockReplyFlush() as fire-and-forget (`void`). This created a race where fast tool results (especially media on Telegram) could be delivered before the text block that preceded the tool call. Await onBlockReplyFlush() so the block pipeline finishes before tool execution continues, preserving delivery order. Fixes #25267 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
Peter Steinberger
parent
4d124e4a9b
commit
99d854db82
@@ -174,7 +174,7 @@ export async function handleToolExecutionStart(
|
||||
// Flush pending block replies to preserve message boundaries before tool execution.
|
||||
ctx.flushBlockReplyBuffer();
|
||||
if (ctx.params.onBlockReplyFlush) {
|
||||
void ctx.params.onBlockReplyFlush();
|
||||
await ctx.params.onBlockReplyFlush();
|
||||
}
|
||||
|
||||
const rawToolName = String(evt.toolName);
|
||||
|
||||
Reference in New Issue
Block a user