@devries-cameron20 / composio-1 / commits / 01af85224
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix: re-index merged multi-execute results to prevent index collisions

Remote results are indexed 0..N within their sub-array, and local results kept their original batch indices — causing collisions in the merged array. Now re-indexes the entire merged array sequentially after concatenation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Dhawal Upadhyay committed Mar 10, 2026 at 21:52 UTC 01af85224c42a8663bf4508250b253610ed596bf
1 file changed +5 -2
ts/packages/core/src/models/ToolRouterSession.ts
+5 -2
@@ -453,11 +453,14 @@ export class ToolRouterSession<
453 ...(result.error ? { error: result.error } : {}),
454 },
455 tool_slug: parsed[index].tool_slug,
456 - index,
456 ...(result.error ? { error: result.error } : {}),
457 }));
458
460 - const allResults = [...remoteResults, ...localEntries];
459 + // Merge and re-index sequentially so there are no collisions
460 + const allResults = [...remoteResults, ...localEntries].map((entry: any, i) => ({
461 + ...entry,
462 + index: i,
463 + }));
464 const hasAnyError = localResults.some(r => r.result.error) || !!remoteResult?.error;
465
466 return {