fix(agent): emit parallel tool completion eagerly\n\ncloses #3503

This commit is contained in:
Mario Zechner
2026-04-22 00:15:56 +02:00
parent 6480b734c1
commit 759d551527
7 changed files with 105 additions and 57 deletions

View File

@@ -547,7 +547,8 @@ Fired for tool execution lifecycle updates.
In parallel tool mode:
- `tool_execution_start` is emitted in assistant source order during the preflight phase
- `tool_execution_update` events may interleave across tools
- `tool_execution_end` is emitted in assistant source order, matching final tool result message order
- `tool_execution_end` is emitted in tool completion order after each tool is finalized
- final `toolResult` message events are still emitted later in assistant source order
```typescript
pi.on("tool_execution_start", async (event, ctx) => {
@@ -698,6 +699,8 @@ pi.on("tool_call", (event) => {
Fired after tool execution finishes and before `tool_execution_end` plus the final tool result message events are emitted. **Can modify result.**
In parallel tool mode, `tool_result` and `tool_execution_end` may interleave in tool completion order, while final `toolResult` message events are still emitted later in assistant source order.
`tool_result` handlers chain like middleware:
- Handlers run in extension load order
- Each handler sees the latest result after previous handler changes