What happened?
Bug 描述
Shell 命令(如 !pwd、!ls)静默失败,返回 exit code 1 且无任何输出。但命令实际已执行(例如写文件操作可以成功),只是 stdout/stderr 未被捕获。
根因
packages/core/src/skills/skill-manager.ts 中的 updateWatchersFromCache() 方法调用 chokidar watch() 时未设置 ignored 选项:
const watcher = watchFs(watchPath, {
ignoreInitial: true,
// ❌ 没有 `ignored` 选项 —— chokidar 会递归监听所有子目录,包括 node_modules
})
当 skill 目录(如 ~/.agents/skills/ 或 ~/.qwen/skills/)中包含 node_modules 时,chokidar 会递归监听其中的所有文件,导致大量 FD(文件描述符)泄漏:
$ lsof -p <qwen-code-pid> | wc -l
15256 # 远超 ulimit -n(通常为 4096)
$ lsof -p <qwen-code-pid> | grep REG | awk '{print $9}' | sort | uniq -c | sort -rn | head -5
438 .../node_modules/.../electron/dist/Electron.app/...
12 .../node_modules/color-name/package.json
12 .../node_modules/color-name/index.js
...
FD 耗尽后,node-pty.spawn() 可以成功创建进程,但 onData/onExit 回调永远不会被触发。进程最终超时,返回 exitCode: 1 且输出为空。
What did you expect to happen?
shell-command 正常执行
Client information
复现步骤
-
安装一个包含大型 node_modules 的 skill(例如依赖了 electron 的 skill)
-
启动 qwen-code
-
执行任意 shell 命令:
-
期望结果:正常输出当前目录路径
-
实际结果:Command exited with code 1. (Command produced no output)
Login information
No response
Anything else we need to know?
No response
What happened?
Bug 描述
Shell 命令(如
!pwd、!ls)静默失败,返回 exit code 1 且无任何输出。但命令实际已执行(例如写文件操作可以成功),只是 stdout/stderr 未被捕获。根因
packages/core/src/skills/skill-manager.ts中的updateWatchersFromCache()方法调用 chokidarwatch()时未设置ignored选项:当 skill 目录(如
~/.agents/skills/或~/.qwen/skills/)中包含node_modules时,chokidar 会递归监听其中的所有文件,导致大量 FD(文件描述符)泄漏:FD 耗尽后,
node-pty.spawn()可以成功创建进程,但onData/onExit回调永远不会被触发。进程最终超时,返回exitCode: 1且输出为空。What did you expect to happen?
shell-command 正常执行
Client information
复现步骤
安装一个包含大型
node_modules的 skill(例如依赖了electron的 skill)启动
qwen-code执行任意 shell 命令:
期望结果:正常输出当前目录路径
实际结果:
Command exited with code 1. (Command produced no output)Login information
No response
Anything else we need to know?
No response