feat(gateway): 新增独立进程骨架与本地IPC探活契约#256
Conversation
|
/review -codex |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
/review |
|
@xgopilot 请你解决review中的问题,并将覆盖率提升至百分之八十以上! |
处理结果已按你的要求完成两项工作:修复 review 问题,并将覆盖率提升到 80% 以上。 已完成改动
验证结果
推送信息
|
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: pionxe <148670367+pionxe@users.noreply.github.com>
|
/review -codex |
| continue | ||
| } | ||
|
|
||
| s.wg.Add(1) |
There was a problem hiding this comment.
Serve 在这里执行 s.wg.Add(1),而 Close 会并发进入 s.wg.Wait()(见 server.go:149),存在 WaitGroup 并发误用。这个问题可被 go test -race ./internal/gateway -run TestServeCloseDuringAcceptDoesNotLeakConnection -count 30 复现。建议把“连接登记 + 计数增加 + 关闭态判断”放到同一受保护临界区,确保不会与 Wait 并发交错。
| continue | ||
| } | ||
|
|
||
| s.wg.Add(1) |
There was a problem hiding this comment.
每个连接都会启动一个 goroutine,当前没有并发上限或背压策略。在本地 IPC 场景下仍可能被大量连接拖垮(goroutine/FD 持续增长)。建议增加连接并发上限(例如 semaphore)并在超限时快速拒绝。
| default: | ||
| } | ||
|
|
||
| frame, err := decodeFrame(reader) |
There was a problem hiding this comment.
读取帧和写回响应都没有 deadline。慢连接或不发送完整帧的客户端会长期占用处理 goroutine(Slowloris 风险)。建议在每轮读/写前设置读写超时,并在活跃连接上刷新 idle timeout。
| } | ||
| } | ||
|
|
||
| func TestNewRestrictedPipeConfigErrorBranch(t *testing.T) { |
There was a problem hiding this comment.
这组测试会修改包级函数变量(如 currentProcessUserSIDFn、wellKnownSIDStringFn 等),但同包内另一些测试使用了 t.Parallel() 并会读取这些全局变量,Windows 下容易出现并发污染和偶发失败。建议对这类“覆写全局钩子”的测试串行执行,或加互斥保护。
|
/simplify |
完成情况已按触发指令完成:读取历史评论并处理未解决 review 点,随后执行了一轮 code-simplifier 子代理复查。 本次已落地修改
验证结果
code-simplifier 结果
提交与推送
未完成项
|
…rdening Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: pionxe <148670367+pionxe@users.noreply.github.com>
|
@xgopilot 你确定没有问题了吗 |
Review 结果本轮基于 已执行校验
残余风险与测试缺口
|
概述
本 PR 新增 NeoCode 的 Gateway 独立进程骨架,初步解耦外部入口与内部运行逻辑。引入本地 IPC 服务端作为统一入口,承接跨端接入的第一层协议处理。当前阶段仅实现
ping -> pong探活与未实现动作的标准错误返回,为后续 URL Scheme、剪贴板和 CLI/TUI 迁移打基础。关联 Issue
Closes #250
核心改动
cmd/neocode-gateway、internal/gateway/transport)如何测试 (Test Plan)
go test ./cmd/neocode-gateway ./internal/gateway/...。go run ./cmd/neocode-gateway(或--listen <自定义地址>)。{"type":"request","action":"ping","request_id":"smoke-1"}{"type":"ack","action":"ping","request_id":"smoke-1","payload":{"message":"pong"}}go run ./cmd/neocode --help,确认旧功能不受影响。影响范围
cmd/neocode-gateway、internal/gateway/transport、internal/gateway/server.gogithub.com/Microsoft/go-winio(Windows Named Pipe)