[Bug][Desktop][Windows] 3.18.2 对话引用插件时 UI 全局无响应(后端存活),与「插件自动推荐」链路相关

Open
#193 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
28/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
node.js, python
Domain
desktop

Research direction

Repro is spelled out: enable plugin auto-recommend, send a message naming a plugin, and check whether the UI stops while ~/.zcode/cli/log/zcode-YYYY-MM-DD.jsonl keeps logging heartbeats. Start from acquireFileLock and the getPluginReferenceCatalog() / SearchPlugins / SuggestPluginInstall path inside the zcode.cjs app-server --stdio --surface desktop process, sampling the lock owner pid in installed_plugins.json.lock and CPU at freeze time. Done means naming the blocking call that ties the UI to the lock, plus a repro that no longer hangs.

Written by the indexing model from the issue text.

Description

环境

  • ZCode Desktop 3.18.2.10443(Windows x64,正式通道安装包,与 cdn-zcode.z.ai stable latest.yml 同一 sha512)
  • Windows 11 Pro 26320(Insider Beta)
  • 插件规模:40 个已安装插件 / 3 个市场(含 1 个 git 型市场);MCP 多组多实例;开启"接受预览版更新"(本次下载包与 stable 相同)

症状

对话中发送的消息里引用/提及插件名时,整个桌面端 UI 无响应:点击任何按钮均无法切换到对应界面,只能结束进程重启。3.5 小时内出现 6 次(本地时间 2026-11-14 19:26 / 21:00 / 21:31 / 21:48 / 21:52 / 23:23 前后,均为结束进程重启的时间点)。

两个值得注意的特征:

  1. 无 OS 级挂起:Windows 应用程序日志全程无 Application Hang (1002) / Application Error (1000),无 WER 档案,无 Crashpad dump。窗口仍在渲染,但事件处理无响应。
  2. CLI 后端存活且健康:冻结发生时 ~/.zcode/cli/log/zcode-YYYY-MM-DD.jsonl 中心跳(zcode_protocol.process.memory_sample)持续;结束进程时后端仍能完成优雅关停(zcode_protocol.shutdown.completed + 全量 MCP lease 释放)。其中 3 次冻结发生前 ≥10 分钟后端无任何业务事件——即用户操作没有到达后端。

关联线索

  1. 触发场景与 3.18.2 新增的插件推荐能力高度重合。本机实测开启该功能时,提示词引用插件后可出现无响应;在设置中关闭「插件自动推荐」后,SearchPlugins / SuggestPluginInstall 随即从会话工具面移除,截至提交时未再复现(观察窗约 1 小时,仍在持续观察)。
  2. 插件状态锁出现异常长持有。~/.zcode/cli/plugins/installed_plugins.json.lock(目录锁,owner 文件含 pid)在无冻结的正常运行时段,实测被 app-server 进程(zcode.cjs app-server --stdio --surface desktop)连续持有 16–43 秒。本地元数据读改写通常不应达到该量级,怀疑锁内包含慢 IO 或网络请求(本机市场含 git 型仓库,网络经代理)。
  3. 冻结高发时段与插件更新流重叠:22:45 市场仓库推送插件新版本 → 22:50 installed_plugins.json 被改写 → 23:23 冻结重启。

怀疑路径(基于 3.18.2 二进制内省,供参考)

  • 插件发现体系(3.18.2 新增):pluginDiscoveryUi / SearchPlugins / SuggestPluginInstall / getPluginReferenceCatalog() / resolveIcon
  • 锁实现:acquireFileLock(目录锁;owner 进程存活时不回收,无论持有时长;进程内同路径请求经串行队列;默认等待上限 8s)
  • 建议排查方向:
    • 插件引用解析/推荐链路中是否存在无超时的跨进程等待(app-server ↔ 插件宿主 __zcode-plugin-host,或持锁期间的网络 IO)
    • 市场元数据刷新/版本检查是否在持有 installed_plugins.json.lock 期间执行网络请求
    • 桌面端 UI 在上述 RPC 未返回时的全局行为(是否存在所有视图切换都依赖同一 RPC 状态的设计)

复现参考

  1. 设置开启「插件自动推荐」(默认关闭;开启后暴露面应显著缩小)
  2. 在对话中发送引用插件名的消息(本机 40 插件 + git 型市场环境)
  3. 观察 UI 是否整体无响应、后端日志是否仍在记录心跳

缓解

设置 → 关闭「插件自动推荐」。关闭后立即生效(下一条输入起),无需重启。

备注

设备号等账号关联信息可按官方反馈流程另行提供,不在公开 issue 中附带。愿意配合进一步取证(冻结时刻的进程 CPU 采样、锁采样日志均可提供)。

Dominant language
Python
Stars
152
Forks
137
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from zai-org/zcode-plugins

All issues in zai-org/zcode-plugins

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.