feat(ptyproxy,gateway): Ask/IDM 交互诊断链路与 Windows ConPTY 全平台兼容#576
Merged
phantom5099 merged 10 commits into1024XEngineer:mainfrom May 8, 2026
Merged
feat(ptyproxy,gateway): Ask/IDM 交互诊断链路与 Windows ConPTY 全平台兼容#576phantom5099 merged 10 commits into1024XEngineer:mainfrom
phantom5099 merged 10 commits into1024XEngineer:mainfrom
Conversation
- 在 runtime ask 调用失败时通过 relay 发布 ask_error 事件,避免前端丢失失败反馈 - 调整 bridge 的 ask 事件转换逻辑,保证错误事件在 run 清理后仍可透传 - 保留 ask chunk/full_response 的原始首尾空白,避免流式输出格式损失 - 补充对应单元测试覆盖异常与空白保留场景
- BuildRequest 在 thinking disabled 场景下不再强制写入 reasoning_effort=none - 与 OpenAI 兼容请求的默认行为保持一致,减少不必要协议噪声 - 更新测试断言,确保禁用场景输出字段被省略
- 提取 bind/diagnosis/notification 共享实现,收敛 Unix 与 Windows 的重复逻辑 - 为 bind_stream 增加 shell 角色与 ACK 校验兼容,补齐相关用例 - 新增诊断游标保护与调度机制,避免 Windows ConPTY 输出插入破坏输入态 - 修复 Windows 输入/回显/换行与屏幕注入细节,提升 IDM 与 ConPTY 稳定性 - 补充多项单元测试覆盖诊断渲染、ConPTY 尺寸与控制台模式等边界场景
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
| session = AskSession{ | ||
| ID: sessionID, | ||
| Workdir: strings.TrimSpace(input.Workdir), | ||
| Skills: normalizeAskSkillIDs(input.Skills), |
There was a problem hiding this comment.
[medium] The public contract says AskInput.Skills are the skills for this ask request, but on a reused ask session they are only read during first-session creation and every later request ignores its input.Skills. That means callers cannot change the active skill set after turn 1, which makes the new API behavior surprising and mismatched with its own documentation.
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.
Summary
本次 PR 聚焦三大主线:(1) 接入 Ask 会话链路,支持
neocode ask与@ai交互诊断模式;(2) 补齐Windows ConPTY 原生跨平台兼容,使 shell/IDM 在 Windows 与 Linux 行为一致;(3)
抽取共享组件收敛重复逻辑并修复若干边界缺陷。
Closes #533
Changes
1. Ask 会话链路 (
neocode ask/ IDM@ai模式)internal/runtime/ask.go、ask_session.go、ask_store.go,实现 Ask会话生命周期管理、上下文存储与流式响应编排;新增
thinking.go提供 reasoning 级别控制。stream_relay.go支持ask_chunk/ask_done/ask_error事件转发;
contracts.go新增 Ask/DeleteAskSession 契约。gateway_runtime_bridge.go增加 Ask 事件转换与 SSE 输出编排;shell_diag_commands.go实现
neocode diag -i进入 IDM 随诊模式。ask_prompt.go构建 Ask 专有系统提示。2. IDM 交互诊断模式
idm_controller.go全面重构,支持@ai <question>异步推理、原生命令透传、Ctrl+C中断、Markdown 终端渲染;新增
idm_ask_test.go、idm_controller_windows_test.go补充覆盖。idm_signal_compat.go、idm_process_unix.go/idm_process_windows.go,统一跨平台信号处理与进程存活检测。\n未转\r\n),统一所有平台的换行规范化。3. Windows ConPTY 原生支持
proxy_windows_conpty.go(~500 行),实现 ConPTY shell进程创建、管线管理、尺寸监控与资源释放;
proxy_windows.go大幅扩展(~1500 行),补齐 shell会话、网关通知订阅、诊断调度、IDM 输入拦截等完整链路。
enableWindowsConsoleModes控制台模式设置;normalizeWindowsConPTYInputByte修复 ConPTY 退格键兼容;
resolveWindowsConPTYSize增强终端尺寸探测回退链。屏幕缓冲区时的光标偏移与内容覆盖问题,确保输入不与已有文本重叠。
windowsCmdShellIntegrationCommand/windowsPowerShellIntegrationCommand注入OSC133 钩子,使 cmd.exe / PowerShell 均支持命令生命周期感知。
4. 跨平台共享逻辑抽取
proxy_bind_shared.go(96 行):抽取 bind_stream 调用、状态回退、ACK 校验共享逻辑,消除Windows/Unix 间重复代码。
proxy_diag_shared.go(374 行):抽取诊断信号消费、去重协调、结果渲染共享链路,收敛runSingleDiagnosisWithCoordinator等核心函数。proxy_notify_shared.go(84 行):抽取网关通知分流(event/control)与载荷解码共享实现。proxy_common_types.go(170 行):提取ManualShellOptions、autoRuntimeState、diagnoseTrigger等公共类型。5. Bug 修复
request.go中 thinking disabled 时不再强制输出reasoning_effort=none,减少协议噪声并与 OpenAI 兼容行为对齐。ask_error事件,避免前端丢失失败反馈;保留ask chunk 原始首尾空白,防止流式格式损失。
6. 测试覆盖
新增测试文件:
proxy_windows_conpty_test.go(316 行)proxy_windows_idm_test.go(373 行)idm_ask_test.go(197 行)proxy_diag_shared相关诊断链路测试ask_prompt_test.go(89 行)gateway_runtime_bridge_test.go增强(+281 行)gateway/bootstrap_test.go增强(+421 行)Test plan
go test ./internal/ptyproxy/...— 全部 PTY/IDM 测试通过go test ./internal/runtime/...— Ask 会话与 thinking 测试通过go test ./internal/gateway/...— 事件转发与 RPC 测试通过go test ./internal/cli/...— 桥接与诊断命令测试通过neocode shell→ 命令错误诊断 → 输入不回覆盖诊断文本neocode diag -i→@ai交互推理 →exit退出@ai输出的 Markdown 排版正常(无换行丢失)neocode shell并响应 OSC133 事件