Skip to content

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

Dhawal Upadhyay01af85224c42
diff --git a/ts/packages/core/src/models/ToolRouterSession.ts b/ts/packages/core/src/models/ToolRouterSession.ts
index 02dea012d..6d7c3cb14 100644
--- a/ts/packages/core/src/models/ToolRouterSession.ts
+++ b/ts/packages/core/src/models/ToolRouterSession.ts
@@ -453,11 +453,14 @@ export class ToolRouterSession<
...(result.error ? { error: result.error } : {}),
},
tool_slug: parsed[index].tool_slug,
- index,
...(result.error ? { error: result.error } : {}),
}));
- const allResults = [...remoteResults, ...localEntries];
+ // Merge and re-index sequentially so there are no collisions
+ const allResults = [...remoteResults, ...localEntries].map((entry: any, i) => ({
+ ...entry,
+ index: i,
+ }));
const hasAnyError = localResults.some(r => r.result.error) || !!remoteResult?.error;
return {