HybridTalentComputing
3b5cb91322
fix(vscode): add timeout to shell integration stream to prevent indefinite hang
VSCode 终端模式下,命令执行完成但输出大量内容时,shell integration 的
]633;D 完成序列可能丢失(自定义 prompt、MSYS2、tmux 等场景尤其常见),
导致 VscodeTerminalProcess.run() 里的 `for await (data of stream)` 永不
退出,completed 事件不 emit,命令框一直显示"等待中/已跳过"。
此时用户被迫 cancel,又因 VscodeTerminalProcess 缺少 terminate() 无法真正
中断,状态进入死区(clineAsk=undefined 且 isTaskRunning=false),后续发送
的消息被消息路由三分支静默吞掉,只能 reload 窗口。
修复:
- 新增 SHELL_INTEGRATION_STREAM_TIMEOUT_MS = 30000 常量
- 把 for-await 循环改为手动迭代 + AbortController 超时竞速
(Promise.race([iter.next(), abortPromise])),30 秒无完成序列则中断
- 超时后走兜底:emit 剩余 buffer + 抓取终端当前内容作为 fallback 输出 +
emit completed/continue,解除卡死
- 流正常结束时取消超时定时器,行为与原来完全一致
移植自 upstream open PR cline/cline#11430 (rodboev)。
2026-06-16 19:57:42 +08:00
..
2026-05-15 13:02:01 +08:00
2026-05-15 13:02:01 +08:00
2026-05-15 13:02:01 +08:00
2026-05-15 13:02:01 +08:00
2026-05-15 13:02:01 +08:00
2026-05-15 13:02:01 +08:00
2026-05-15 13:02:01 +08:00
2026-06-16 19:57:42 +08:00