This repository was archived by the owner on May 15, 2026. It is now read-only.
Commit e561754
committed
fix: use ID-based lookup for parallel tool finalization
Replaces map-based index tracking with direct ID lookup when finalizing
streaming tool calls. This prevents duplicate rendering of parallel tools
by ensuring idempotent processing.
Changes:
- Use findIndex with partial===true check instead of streamingToolCallIndices
- Skip already-finalized tools to eliminate race conditions
- Works for both sequential and parallel tool calling modes
The previous approach relied on streamingToolCallIndices map which could
become stale when multiple code paths (finalization loop, sweep fix,
pending updates) process the same tool, causing duplicate rendering.1 parent dc5e765 commit e561754
1 file changed
Lines changed: 19 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3240 | 3240 | | |
3241 | 3241 | | |
3242 | 3242 | | |
3243 | | - | |
3244 | | - | |
| 3243 | + | |
| 3244 | + | |
| 3245 | + | |
| 3246 | + | |
| 3247 | + | |
| 3248 | + | |
| 3249 | + | |
| 3250 | + | |
| 3251 | + | |
| 3252 | + | |
| 3253 | + | |
| 3254 | + | |
| 3255 | + | |
| 3256 | + | |
| 3257 | + | |
3245 | 3258 | | |
3246 | 3259 | | |
3247 | 3260 | | |
3248 | 3261 | | |
3249 | 3262 | | |
3250 | | - | |
3251 | | - | |
3252 | | - | |
3253 | | - | |
| 3263 | + | |
| 3264 | + | |
3254 | 3265 | | |
3255 | 3266 | | |
3256 | 3267 | | |
| |||
3260 | 3271 | | |
3261 | 3272 | | |
3262 | 3273 | | |
3263 | | - | |
| 3274 | + | |
3264 | 3275 | | |
3265 | 3276 | | |
3266 | 3277 | | |
3267 | | - | |
| 3278 | + | |
3268 | 3279 | | |
3269 | 3280 | | |
3270 | 3281 | | |
| |||
0 commit comments