Status: needs-triage
面板显示「MCP App connection is no longer available」和「重试」按钮,沙箱不握手。用户点「重试」后才恢复。
sequenceDiagram
participant UI as 面板页 (renderer)
participant Agent
UI->>UI: 关标签,页面留在 registry(running)
Note over Agent: 禁用插件 → 插件重载,MCP 连接失效
Agent->>UI: pluginUi.instanceClosed
UI->>UI: onInstanceClosed → suspend + closeInstance,phase=error
Note over UI,Agent: 重新启用插件
UI->>UI: 打开同一 surface key,usePluginUiHost 读到同一个 error 页
UI->>UI: ensure() 遇到 phase=error 直接返回,不重建
apps/zcode-cli/packages/bootstrap/src/zcode-protocol/mcp-ui/protocol.ts 的 onMcpAppConnectionInvalidated 关闭实例,并发出 PluginUiInstanceClosed。packages/ui/src/plugin-ui/adapters/pluginUiManagedPage.ts 的 onInstanceClosed 把页面置为 error,页面仍在 registry 里;ensure() 遇到 phase === "error" 直接返回。usePluginUiHost 用同一个 surface key 取回这个页面。desktop-e2e-20261113093800335-p61934-02894b31e50a6f53,临时取证日志已删除):
closeInstance。lease:true, rows:6, presentation:true, phase:"error",之后 60 秒没有 preparing。desktop-e2e-20261113100430717-p85049-e23b805eae0cb952,15d 截图同样显示「MCP App connection is no longer available」和「Reload」。用户禁用插件后再启用,打开面板时会看到连接错误,必须手动点「重试」。不影响配置写入,也不影响冷启动打开。
需要先决定实例撤销后页面的归属。有两个方向:
决定之后先更新插件 UI 生命周期 spec,再改实现,并在 PLM-UI-001 的 15d 恢复沙箱握手断言。
2026-11-13 修复插件市场开关作用域(fix/plugin-market-toggle-user-scope)时,新增的 PLM-UI-001 15d 步骤暴露了这个问题。发布基线已存在,不是该分支引入。该分支的 15d 只断言 User 写入和面板标签打开,不等沙箱握手。