mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-20 15:40:29 +01:00
21050e2d37
## Problem When subagents use the `edit_file` tool, it creates an `EditAgent` that makes its own model request to get the edit instructions. These "nested" requests compete with the parent subagent conversation requests for rate limiter permits. The rate limiter uses a semaphore with a limit of 4 concurrent requests per model instance. When multiple subagents run in parallel: 1. 3 subagents each hold 1 permit for their ongoing conversation streams (3 permits used) 2. When all 3 try to use `edit_file` simultaneously, their edit agents need permits too 3. Only 1 edit agent can get the 4th permit; the other 2 block waiting 4. The blocked edit agents can't complete, so their parent subagent conversations can't complete 5. The parent conversations hold their permits, so the blocked edit agents stay blocked 6. **Deadlock** ## Solution Added a `bypass_rate_limit` field to `LanguageModelRequest`. When set to `true`, the request skips the rate limiter semaphore entirely. The `EditAgent` sets this flag because its requests are already "part of" a rate-limited parent request. (No release notes because subagents are still feature-flagged.) Release Notes: - N/A --------- Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>