Repository navigation
fix(server): run a round's tools at most 16 at a time - #1596
Open
Aditya-thesys wants to merge 1 commit into
Open
Aditya-thesys wants to merge 1 commit into
Aditya-thesys wants to merge 1 commit into
Conversation
A script round's whole batch ran at once with Promise.all, so a large batch (48 from an honest sandbox once the call limit rises, up to the SDK's backstop from a misbehaving server) started that many of the developer's tools simultaneously. A small pool caps it at 16, keeps the result order, and starts no more tools once the run is aborted or times out.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does better
A dashboard script can't make your backend run a large batch of your tools all at once: tools from one round run at most 16 at a time.
Problem
@openuidev/serverruns each round's tool calls withPromise.all, so a round's whole batch starts at once. Today the SDK caps a run at 16 calls, so that's at most 16. With #1560 (the sandbox owns the limit; the SDK keeps a 256 backstop) an honest sandbox can send 48 in one round, and a misbehaving or compromised server up to 256, and every one of them would start at the same time against the developer's databases and paid APIs, on every query of every dashboard view. Found by a security review of #1560.Fix
packages/server/src/tools/execute.ts: a smallmapWithLimitpool runs a round's calls at most 16 at a time. The results go back in the same order as before, and a run that has timed out or been aborted starts no new tools.Evidence
On #1560's code, a round of 64 calls ran with a peak of exactly 16 at once, results in call order; after a 20 ms timeout no 17th tool started. On main alone (16 calls per run) behavior is unchanged.
Tests
@openuidev/server:tscclean, eslint clean, vitest 11/11. Changeset:@openuidev/serverpatch.🤖 Generated with Claude Code
https://claude.ai/code/session_01DuFZ75cVMd52YVqv9C6XBF