Repository navigation
fix(buddy): 网页请求超过并发上限时排队而不是直接拒绝 - #480
Merged
Merged
Conversation
Contributor
Author
|
我觉得要不要调高上限,因为子代理外加codemode这个工具,并发上限明显就高了 |
Contributor
|
这个确实是需要处理下 |
shanyuhai123
force-pushed
the
codex/web-request-queue
branch
from
October 28, 2026 01:41
233a215 to
af0069c
Compare
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.
背景与关联 / Context and related issue
WEB_BUSY,不排队。主代理、子代理或 codemode(同时放行 16 个工具调用)并行发起网页请求时,会反复撞上这个上限;被拒的请求没有自动重试,本来能访问的网页就被当作“正文获取失败”交付。页面渲染还有一个更小的上限(同时 2 个),抓取需要渲染的页面(如微信公众号文章)会先撞上它。实测中两次抓取在 5 毫秒、26 毫秒内返回WEB_BUSY,单独重试同一链接约 1 秒即成功,说明不是目标网站的问题。主要改动 / Changes
WebConcurrencyGate:满额后进入有界等待队列,最长等待 30 秒,队列最多 64 个,超出才返回WEB_BUSY;排队中被取消或应用关停时立即退出队伍,不占名额。WebCapabilityService.#run先取名额再执行。90 秒执行超时在拿到名额后才开始计时,排队时间不占用。WEB_QUEUE_TIMEOUT,表示排队超时、尚未访问目标网站,与目标网站失败区分;新增诊断阶段queued,started带上排队耗时。验证 / Verification
pnpm exec vitest run service/src/web(apps/buddy)9 个文件 39 个用例通过。新增 3 个用例:6 个请求同时提交时同时执行不超过 4 个且全部完成;排队中取消后返回WEB_CANCELLED且名额不泄漏;排队超过 30 秒返回WEB_QUEUE_TIMEOUT且attempts为空。type-check、渲染排队的专门用例、Windows 上的实机验证。宿主侧“同时 8 个请求”的上限仍是立即拒绝,本 PR 未改动。兼容与风险 / Compatibility and risks
WebConcurrencyGate里名额交接与取消、超时的竞争处理。界面变更 / UI changes
不适用 / N/A