feat(diag): 实现终端诊断系统 Phase 1 (Manual 模式最小闭环)#541
Merged
phantom5099 merged 8 commits into1024XEngineer:mainfrom May 1, 2026
Merged
feat(diag): 实现终端诊断系统 Phase 1 (Manual 模式最小闭环)#541phantom5099 merged 8 commits into1024XEngineer:mainfrom
phantom5099 merged 8 commits into1024XEngineer:mainfrom
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
|
||
| ```bash | ||
| # 进入代理 shell(Phase1 仅支持 Unix) | ||
| neocode shell |
There was a problem hiding this comment.
Reviewed the changed areas; no actionable issues found.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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.
🎯 背景与目标
为了打造沉浸式的 NeoCode 终端协作体验,本 PR 落地了
Terminal Diagnostic System(终端诊断系统) 的 Phase 1。该阶段重点打通了:底层 PTY 劫持 -> Ring Buffer 缓存 -> 跨进程 Socket 触发 -> 网关工具链路由 -> 原位结果渲染 的全链路闭环,为后续真正接入 LLM 根因分析奠定了坚实的基础设施。🚀 核心更新内容
1. 架构解耦与重构
gateway_rpc_client从 TUI 展现层彻底抽离并下沉至internal/gateway/client,清理了业务职责,实现各组件间统一且干净的网关调用复用。2. 底层 PTY 代理中枢 (
internal/ptyproxy)creack/pty实现了对 Bash/Zsh 的子进程拉起与标准流的io.Copy透明代理。RingBuffer(64KB),防止终端报错日志溢出,并保障日志截取不产生乱码。3. IPC 通信与命令行扩展 (
internal/cli)neocode shell(启动主代理与 Unix Socket 监听)与neocode diag(轻量化纯发信令客户端)。NEOCODE_DIAG_SOCKET,实现了父子进程无感知的 IPC 路由互通。4. 系统工具集成 (
internal/tools)diagnose,并在names.go与bootstrap.go中完成系统级注册验证。🛠️ 关键体验优化 (UX Improvements)
本 PR 深入处理了多个典型的底层终端痛点,保障商业级手感:
pty.InheritSize与监听SIGWINCH信号,使得代理能够动态继承宿主终端尺寸,彻底解决了由于尺寸未同步导致的**“长命令输入覆盖重写”** Bug。term.MakeRaw与Restore状态,消灭了双重回显(结巴)、CPR(光标位置报告)乱码,并优雅吞噬了Ctrl+V带来的^[[200~括号粘贴符。\r\n渲染;并将异步的neocode diag改造为阻塞等待结果完成,避免原生 Bash Prompt 越界“插队”。[ NeoCode Proxy initialized/exited ]提示。🧪 测试路径
go build -o neocode ./cmd/neocode./neocode shell进入接管模式,确认常规操作(如ls)与缩放终端无异常。cat /a/non-existent/file。./neocode diag。[NeoCode Diagnosis]相关 Mock 数据及建议指令。输入exit顺畅退出代理。📋 提交前检查清单 (Checklist)
AGENTS.md)。Closes #524