MoonshotAI / MoonshotAI/kimi-code
[Bug] VSCode 扩展 v0.6.4:Bash 工具 Approval 因 Session Closed 被取消后,前端 UI 永久卡在 "Thinking" 状态
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
What version of Kimi Code is running?
扩展标识符: moonshot-ai.kimi-code, 扩展版本: 0.6.4
Which open platform/subscription were you using?
Kimi Code (VSCode Extension) + Moderato subscription
Which model were you using?
K2.7 Coding
What platform is your computer?
Microsoft Windows NT 10.0.19045.0 x64
What issue are you seeing?
问题描述
在使用 VSCode 扩展 moonshot-ai.kimi-code(v0.6.4)进行自动化脚本执行时,当 Agent 决定运行脚本后,UI 会显示:
Thinking: Now let me run the script.
但等待一段时间后发现无进一步输出,且用户输入被回退至输入框,其进程并未真正结束。必须在尝试重新发送用户输入后手动点击「停止按钮」或直接重启 VSCode 才能终止该状态。
但是在手动点击「停止按钮」或直接重启 VSCode 后,再次进入该 session,输入“继续”,该 session 可以继续执行原定的 运行脚本 操作而用户输入不再被回退至输入框。
What steps can reproduce the bug?
复现步骤
- 在 VSCode 中打开 Kimi Code 扩展侧边栏。
- 向 Agent 发送需要执行自动化脚本(如运行测试、构建命令等)的指令。
- Agent 进入 "Thinking" 状态,且内部思索带有 "Now let me run the script." 等类似字样。
- 界面卡死( "Thinking" 右侧加载动图常驻),输入框回退显示原始用户输入,但进程未结束。
- 在尝试重新发送用户输入后手动点击「停止按钮」或重启 VSCode 后,进入原"session",在"Thinking"状态下方出现未执行成功的
script,显示:
Tool "Bash" was not run because the approval request was cancelled. Reason: Session closed
注:该 bug 可能存在复现困难情况,但存在思索链/工具调用链越长出现概率越高的情况(仅推测,待确定)
What is the expected behavior?
预期行为
当 Bash 工具的 Approval Request 因 Session Closed 被取消时,VSCode 扩展前端应正确同步该取消状态,终止当前 Agent Turn,并允许用户继续发送新的指令。
实际行为
Approval 被取消后,前端 UI 未收到状态同步信号,永久卡在 "Thinking" 状态( "Thinking" 右侧加载动图常驻),用户输入被回退,底层进程处于"僵尸"状态,必须通过手动点击「停止按钮」或重启 VSCode 才能强制终止。
Additional information
环境信息
- VSCode 扩展标识符:
moonshot-ai.kimi-code moonshot-ai.kimi-code扩展版本:0.6.4- VSCode 版本:
1.129.1(user setup) - VSCode 提交:
8a7abeba6e03ea3af87bfbce9a1b7e48fed567b8 - VSCode 日期:
2026-07-17T15:35:09Z - Electron:
42.6.0 - Node.js:
24.18.0 - 操作系统:
Windows_NT x64 10.0.19045 - Windows 版本: Windows 10 家庭中文版 22H2
初步分析(使用kimi网页版,kimi2.6[进阶] 进行辅助分析)
推测问题出在 VSCode 扩展 Webview 前端与 CLI 后端之间的状态同步:
- Agent 发起 Bash 工具调用并进入 Approval 等待。
- 等待期间 Session 因某种原因(如内部超时、通信中断)被标记为
closed。 - 后端已取消 Approval Request,但前端未正确同步该取消事件,导致 UI 死锁。
- 这可能与 kimi-cli 历史版本中修复过的 approval 挂起/同步问题(如 v1.30.0 的 300s 超时、v1.25.0 的工具状态同步)可能属于同一类 race condition 的未覆盖场景。
附加信息
- 该问题在需要自动化执行脚本的 session 中较易复现,且存在思索链/工具调用链越长出现概率越高的情况(仅推测,待确定)。
- 目前临时规避方案:使用
/auto模式跳过了 Bash Approval 流程。但是并不清楚使用该模式是否能够真正规避该bug出现。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the VSCode extension webview frontend and CLI backend handling Bash approval cancellation when a session closes. Reproduce the issue with a script-running request and verify that the cancellation is reflected in the UI, the Agent turn ends, and a new user instruction can be sent without restarting VSCode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- frontend, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100