MoonshotAI / MoonshotAI/kimi-code
Issue: macOS 上 kimi-code CLI 因 clipboard.darwin-universal.node 死锁而无限卡住
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?
0.27.0 / 0.26.0
Which open platform/subscription were you using?
open platform - Kimi.com
Which model were you using?
all models
What platform is your computer?
macOS 26.5.2 (25F84) — Darwin ARM64
What issue are you seeing?
环境信息
- 操作系统: macOS 26.5.2 (25F84) — Darwin ARM64
- Node.js: v22.23.1(也测试过 v18.20.8,问题相同)
- kimi-code 测试版本: 0.26.0、0.27.0(两个版本都能复现)
- 安装方式:
npm install -g @moonshot-ai/kimi-code
问题描述
kimi CLI 在执行任何会触发 prompt 的命令或进入交互模式时,会无限卡住。进程完全无响应 —— Ctrl+C 无法中断,只能通过 Ctrl+D 或关闭终端来终止。
这个问题是必现的,不是偶发。
复现步骤
- 安装 kimi-code CLI:
npm install -g @moonshot-ai/kimi-code - 成功登录:
kimi login(登录本身正常) - 执行任意 prompt:
kimi -p "你好"或进入交互模式:kimi - CLI 永远卡住,没有任何输出
已尝试的排查手段(均未解决)
- 完全卸载重装(0.26.0 和 0.27.0 都试过)
- 清理所有缓存:
~/.kimi-code、~/Library/Caches/kimi-code等 - 升级 Node.js 从 v18 到 v22
- 禁用/清除所有系统代理(HTTP、HTTPS、PAC)
- 开关 VPN 测试
- 杀掉所有 Kimi Desktop 进程避免冲突
- 清空系统剪贴板(
echo -n "" | pbcopy) - 显式指定模型测试:
kimi -p "你好" -m moonshot-cn/kimi-k3
关键诊断发现
使用 sudo sample 采样卡死的进程,发现了根本原因:
主线程卡在 kevent(事件轮询):
Thread_235420 DispatchQueue_1: com.apple.main-thread (serial)
node::SpinEventLoopInternal(node::Environment*)
uv_run
uv__io_poll
kevent ← 卡在这里
多个来自 clipboard.darwin-universal.node 的 Tokio worker 线程在条件变量上死锁:
Thread_235429: tokio-runtime-worker
??? (in clipboard.darwin-universal.node)
_pthread_cond_wait
__psynch_cvwait ← 所有 clipboard 线程都卡在这里
这说明 clipboard.darwin-universal.node 原生模块在初始化时发生死锁,导致整个 Node.js 事件循环挂起。
API 本身正常的验证
直接用 curl 调用 Moonshot API 完全正常:
curl -s https://api.moonshot.cn/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-d '{"model":"kimi-k3","messages":[{"role":"user","content":"你好"}]}'
能立即返回正确响应。这严格是 CLI 客户端的 bug,不是网络或 API 问题。
补充上下文
- CLI 在首次安装后短暂正常过(使用了约 3 元钱的
kimi-k2.7-codetoken) - 那次初始会话之后,就再也没正常过 —— 每次启动必卡
- 即使完全重置系统状态(重装、清缓存、重启)问题依然复现
请求
请调查 clipboard.darwin-universal.node 原生模块在 macOS 上的兼容性问题。该模块似乎在某些 macOS 配置下初始化时就会死锁。
What steps can reproduce the bug?
复现步骤
- 安装 kimi-code CLI:
npm install -g @moonshot-ai/kimi-code - 成功登录:
kimi login(登录本身正常) - 执行任意 prompt:
kimi -p "你好"或进入交互模式:kimi - CLI 永远卡住,没有任何输出
What is the expected behavior?
CLI 永远卡住,没有任何输出
Additional information
No response
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
Reproduce the hang with npm install -g @moonshot-ai/kimi-code, then kimi -p "你好" or kimi, on macOS ARM64. Inspect the initialization of clipboard.darwin-universal.node and use sudo sample to compare the main thread and clipboard worker threads; done means prompt and interactive modes no longer hang while the direct API behavior remains unaffected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, node.js, typescript
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100