chore(lint): parallelize pending permission approvals

approvePendingPermissions now filters and records handled IDs in a
sync pass, then awaits all allowPermission calls concurrently instead
of looping awaits.
This commit is contained in:
Mohamed Boudra
2026-04-24 03:22:09 +07:00
parent ec6a35b8cb
commit e27de5e2c3

View File

@@ -120,13 +120,11 @@ async function approvePendingPermissions(
): Promise<void> {
const snapshot = await client.fetchAgent(agentId).catch(() => null);
const pending = snapshot?.agent.pendingPermissions ?? [];
for (const permission of pending) {
if (handledPermissionIds.has(permission.id)) {
continue;
}
const toApprove = pending.filter((permission) => !handledPermissionIds.has(permission.id));
for (const permission of toApprove) {
handledPermissionIds.add(permission.id);
await allowPermission(client, agentId, permission);
}
await Promise.all(toApprove.map((permission) => allowPermission(client, agentId, permission)));
}
async function waitForRunningBashToolCall(