Skip to content

feat: Doctor 工具错误捕获+结构化遥测+修复能力补全#49

Merged
liuqihonggit merged 11 commits into
mainfrom
w2
Jul 18, 2026
Merged

feat: Doctor 工具错误捕获+结构化遥测+修复能力补全#49
liuqihonggit merged 11 commits into
mainfrom
w2

Conversation

@liuqihonggit

Copy link
Copy Markdown
Owner

Summary

  • PermissionAwareToolExecutor 添加 ToolExecutionCompleted 事件,捕获工具执行结果(成功/失败)
  • 病人端订阅事件,通过 SSE 转发 tool_error/tool_success 给医生
  • DiagnosticEngine 添加 D006 ToolExecutionError 规则(同一工具连续失败3次触发诊断)
  • HotFixEngine.BuildConfigChangeAction 为 ToolPermissionDenied 自动生成 PatchedContent
  • SourceCodePatch 缺少 PatchedContent 时返回人工介入提示而非失败
  • 79个 Doctor 单元测试全部通过

…| 决策: TestSuite独立类不嵌入DoctorAgent,DoctorModeRunner直接编排测试循环
…istener容错 | 决策: ConnectAsync先于SpawnAsync,Diag.WriteLifecycle替代WriteLine确保输出,WaitForExitAsync自行更新Info避免竞态
… 输出 | 决策: 消除ILogger?参数避免日志被吞,DoctorDiag.Write/WriteError无条件输出到stderr
…r 解决沙盒环境不可用问题 | 决策: HttpListener依赖HTTP.sys在受限环境抛句柄无效,TcpListener纯用户态零依赖兼容所有环境,手动实现HTTP协议解析(SSE/POST/health路由),RunAcceptLoop用Task.Run确保线程池调度,拆分KillAsync/RemovePatientAsync避免重启时病人已存在异常,DoctorAgent订阅病人stderr/stdout转发到Trace
…ner在受限环境不可用,DoctorTcpServer已完全替代,旧代码移至.xxx/备份
…决策: DiagnosticEngine.ClassifyDiagOutput从RawData解析实际事件类型,CommandReceived订阅日志记录,_fixLock移除嵌套获取修复死锁,ReadHttpRequestAsync按Content-Length读取完整body,SSE重连成功后重置retryDelay
…tAsync用TaskCompletionSource等待SSE实际建立,SSE连接10s轮询TcpClient.Connected检测断开,DetectEventType仅诊断行前缀下匹配关键字,SendEventAsync用JsonSerializer替代手动拼接
…TargetFilePath从事件Properties提取source_file/file_path/source,LoopDetected按tool推断中间件文件,配置热更新添加VerifyConfigChangeAsync轮询验证,T002改为只读操作避免副作用,--doctor-server替代--doctor-endpoint判断服务器模式,移除DoctorEndpoint误用作JCC_ENDPOINT
…oolExecutionCompleted事件捕获工具执行结果,病人端订阅事件通过SSE转发tool_error/tool_success给医生,DiagnosticEngine添加D006 ToolExecutionError规则(同工具连续失败3次),HotFixEngine.BuildConfigChangeAction为ToolPermissionDenied自动生成PatchedContent,SourceCodePatch缺少PatchedContent时返回人工介入提示而非失败
@liuqihonggit
liuqihonggit enabled auto-merge (squash) July 18, 2026 21:07
@liuqihonggit
liuqihonggit merged commit 12f053f into main Jul 18, 2026
31 of 32 checks passed
@liuqihonggit
liuqihonggit deleted the w2 branch July 18, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant