fix(cli): WS 退避握手架空 + send 正文 --help 被吞(#373)#375
Merged
Conversation
两条经对抗性验证的健壮性问题: 1) WS 重连退避在握手完成即清零(client.ts):attempt=0 放在 sock.onopen, TCP/WS 101 握手一完成就清零、不等业务层 welcome。服务端"accept 后立刻 close"(过载保护/拒绝/半坏实例)会让长跑 serve/watch 退化成 ~1 次/秒无限 紧循环锤服务端。改到 onmessage 收到首个可解析业务帧才清零(accept-then- close 永远走不到),退避恢复生效。 2) --help/-h 在正文里被当 flag 吞掉整条 send(args.ts:isHelpArg):对整 argv 匹配、无视 `--` 终止符。`party send -- "见 --help 说明"` 会命中 help、打印帮助、以 0 退出,消息从未发出且无报错,agent 自以为发了。改成 只扫 `--` 之前的 token(parseArgs 已把 `--` 后的都归 positionals)。 验证:cli 658 用例全过(含 6 个新增 isHelpArg 终止符测试)、tsc 干净。 退避修复happy-path 由现有 reconnect 测试兜底;accept-then-close 计时测试 易 flaky(#43/#48 史),靠代码审查。 Closes #373 Claude-Session: https://claude.ai/code/session_01PgxkZeqJmDge3dYe9W2tPZ
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.
两条经对抗性验证的健壮性问题(#373),leo-claude 接管(原 assignee leo-codex serve 已死)。
1. WS 重连退避被握手架空 — cli/src/client.ts
attempt = 0(指数退避计数)放在sock.onopen,TCP/WS 101 握手一完成就清零,不等业务层 welcome。服务端"accept 后立刻 close"时,客户端每次:连上→清零退避→立刻断→无退避重连,退化成 ~1 次/秒无限紧循环锤服务端,长跑 serve/watch 首当其冲。修复:把清零移到
onmessage收到首个可解析业务帧时(accept-then-close 永远走不到那里)。幂等。happy-path 由现有 reconnect 测试兜底(welcome 是帧,照常触发清零)。2. send 正文含 --help 被静默吞掉 — cli/src/args.ts
isHelpArg对整 argv 匹配--help/-h,无视 POSIX--终止符。party send -- "见 --help 说明"命中 help→打印帮助→以 0 退出,消息从未发出且无报错,agent 自以为发了实则石沉大海。修复:help 判定只扫
--终止符之前的 token(parseArgs 已把--之后的都归 positionals,正文得以保留)。验证
--终止符测试)、tsc 干净Closes #373
https://claude.ai/code/session_01PgxkZeqJmDge3dYe9W2tPZ