Repository navigation
WebSocket 帧大小上限:/api/ws 1 KiB、/agent 16 MiB,运行器按字节分批上传工作记录 - #86
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Be3SZps2JjqvyrJ1vbLmni
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Be3SZps2JjqvyrJ1vbLmni
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Be3SZps2JjqvyrJ1vbLmni
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Be3SZps2JjqvyrJ1vbLmni
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Be3SZps2JjqvyrJ1vbLmni
joesmart
force-pushed
the
joesmart/sec-ws-maxpayload
branch
from
October 23, 2026 14:40
e5aa106 to
4a78f2c
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.
改了什么
packages/shared/src/protocol.ts:新增AGENT_FRAME_MAX_BYTES = 16 MiB,作为/agent单帧上限的唯一来源。packages/control-plane/src/server.ts:/api/ws的maxPayload设为 1 KiB(PUSH_MAX_PAYLOAD),/agent用AGENT_FRAME_MAX_BYTES。原来两条都是 ws 默认的 100 MiB。/api/ws的推送连接补上error监听:ws 遇到超限帧会以 1009 关连接并发出error,原来没人监听,这个error会变成未捕获异常,一帧就能打崩控制面。packages/bot-runner/src/work-mirror.ts:work_append原来只按 64 行分批,现在同时按字节分批,每帧留 64 KiB 给其余字段和信封。单条就超过上限时停流,不发出去。为什么这么做
/api/ws上只收不发,1 KiB 已经够宽。/agent上限不能只在控制面卡,发送方必须先按同一个数切。否则一批偏大的work_append(单行不限字节:toolCall参数、thinking 都不截断)会让这台电脑陷入“重发、被关、再重发”的循环。hub.ts原来就有(HELLO_TIMEOUT_MS = 10_000,到点按badHello关),代码没改,只补测试钉住。新测试
control-plane/test/ws-max-payload.test.ts(4 条):/api/ws 超限帧以 1009 关、正常推送不受影响;/agent 握手前后超 16 MiB 的帧以 1009 关、4 MiB 的照收照确认;10 秒不报 hello 按坏 hello 关。在 main 的 server.ts 上,前 3 条失败。bot-runner/test/work-mirror.test.ts新增 2 条:「一批条目加起来超过上行帧上限时按字节分批,每帧都在上限以内,条目一条不落」「单条就超过上行帧上限时停流,前面的照传,超限的那条不发出去」。改运行器之前这 2 条都失败。怎么验证的(本机)
pnpm format:check && pnpm typecheck && pnpm lint:通过,lint 0 错误pnpm --filter @baize/control-plane test:1534 passed | 1 skippedpnpm --filter @baize/bot-runner test:1703 passed | 15 skippedpnpm --filter @baize/computer-agent test:194 passed | 1 skippedpnpm --filter @baize/shared test:277 passedpnpm --filter @baize/e2e test:53 passedpnpm --filter @baize/web test:vitest 351 passed,Playwright 453 passedCloses #28
🤖 Generated with Claude Code
https://claude.ai/code/session_01Be3SZps2JjqvyrJ1vbLmni