Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/approval-parallel-calls.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@roomote/cloud-agents': patch
---

Fix tool approvals showing and checking the wrong arguments when an agent calls the same tool several times at once.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,23 @@ function integrationDisplayName(integrationId: string): string {
return integrationNames.get(integrationId) ?? formatIdentifier(integrationId);
}

/**
* The calls of a batch card: several calls to one tool that ran together.
* The server records them as a list, which a single call's arguments (always
* an object) never are.
*/
function parallelCalls(argsSummary: unknown): unknown[] | null {
return Array.isArray(argsSummary) && argsSummary.length > 1
? argsSummary
: null;
}

function approvalPrompt(item: IntegrationToolApprovalMetadata): string {
const name = integrationDisplayName(item.integrationId) || 'this integration';
const batch = parallelCalls(item.argsSummary);
if (batch) {
return `Let ${name} run these ${batch.length} calls?`;
}
const normalizedToolName = item.toolName.toLowerCase();
const argumentKeys =
item.argsSummary &&
Expand Down Expand Up @@ -81,6 +96,12 @@ function describeAutoEvaluation(
}

function summarizeArgs(argsSummary: unknown): string | null {
const batch = parallelCalls(argsSummary);
if (batch) {
return batch
.map((call) => JSON.stringify(call ?? {}, null, 2) ?? '{}')
.join('\n\n');
}
if (
argsSummary === null ||
argsSummary === undefined ||
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading