-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Per-session rate limit on tool calls #262
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededrfcArchitecture proposal / request for commentsArchitecture proposal / request for commentsv1Legacy TypeScript line (0.x) — v1 branch, maintenance onlyLegacy TypeScript line (0.x) — v1 branch, maintenance only
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededrfcArchitecture proposal / request for commentsArchitecture proposal / request for commentsv1Legacy TypeScript line (0.x) — v1 branch, maintenance onlyLegacy TypeScript line (0.x) — v1 branch, maintenance only
Background
The budget system (cost / token caps, landed in 0.12.x) prevents runaway spending, but not runaway frequency. A loop bug or a model going in circles can fire hundreds of
run_commandcalls in seconds — fine on cost terms (each call is cheap) but bad for filesystem / disk / spawn pressure, and a real DoW vector when the loop also makes API calls.OWASP AI Agent Cheat Sheet § 5 cites
"max_calls": 100, "window_seconds": 60as the canonical pattern.Proposal
Sliding-window rate limiter at the tool-dispatch boundary. Defaults (suggested, not load-bearing):
run_command/run_background: 60 calls / 60sWhen the limit fires, the tool call returns an error to the model ("rate-limited, slow down"); the next loop tick can retry once the window slides. UI surfaces the throttle state.
Open design questions
This is
rfc-tagged — please discuss in the issue before opening a PR:Acceptance criteria (post-RFC)
ToolRegistry.dispatch(or wherever the boundary lands after design)Out of scope
References
src/core/budget*.tsgit branch -dbypasses review mode #257, fix(shell): demote destructive flags on allowlisted commands #258