Repository navigation
All tool calls fail with Cannot read properties of undefined (reading 'prepare') after installing third-party profile plugins — duplicate dsh-tools module instance splits TOOL_RUNTIME_SCHEDULER | 安装第三方 profile 插件后所有工具调用报错:dsh-tools 模块双实例导致 Symbol 分裂
#2660
Replies: 2 comments 2 replies
|
我也遇到了这个问题 |
|
This thread is the canonical root cause for the 1. Second confirmation: #3033 (2026-08-18). Independent report on macOS + rc.7 — installing 2. Family lineage — this is the 8th report of a known family. #1486/#783/#1515 (community roots) → #1337 → #1633 → #1665 → #1677 → #1697 → #1959 → #2660 → #3033. All share the 3. On your fix suggestions — verified at rc.7, still all unimplemented:
4. The convergence value: #2660 (canonical root cause + probe) + #3033 (macOS/bundled-copy confirmation) + #2661 (dangling-call consequence) + #2900 (family #9) form one complete chain: trigger (duplicate copy) → crash ( 中文摘要:你这个帖是 'prepare' 崩溃的标准根因帖(探针证据全家族最强)。#3033(macOS + rc.7 + 插件内置副本)独立确认了同一机制,触发模型扩展为"任何第二物理副本"。家族共 8+ 帖(#1486/#783/#1515 → #1337/#1633/#1665/#1677/#1697/#1959/#2660/#3033)。你的三个修复建议在 rc.7 均未实现;#3(loader 对 @deepseek-ai/dsh-* 优先按安装锚点解析)是新增蓝图,与 denylist(声明侧)/运行时守卫(失败侧)互补。四帖(根因 + 确认 + 悬空后果 + 家族 #9)合起来就是完整的一 PR 描述。 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Environment
0.1.0-rc.6(installed globally via npm, launched withnpx @deepseek-ai/dsh web)~/.dsh/profiles/webwith third-party plugins@anweat/dsh-browser@0.1.3anddsh-find-plugin@0.3.6Symptom
Every tool call (Glob, read, pwsh — any tool) fails immediately. The turn ends with:
and every subsequent message fails with:
The server boots fine, the UI renders fine — only tool execution is broken.
Root cause: duplicate dsh-tools module instances
TOOL_RUNTIME_SCHEDULERis a module-localSymbol("...scheduler"). Two physical copies of@deepseek-ai/dsh-toolsend up loaded in one process:dsh-agent-loopresolves@deepseek-ai/dsh-toolsfrom the main package's nested node_modules (global npm install).ToolRuntimeis constructed from the profile's hoisted copy (~/.dsh/profiles/web/node_modules/@deepseek-ai/dsh-tools), which pnpm hoisted there because the third-party plugins depend on it.Each copy creates its own Symbol. Descriptions are identical but identity differs, so
ctx.tools[TOOL_RUNTIME_SCHEDULER]isundefinedat runtime even though the instance has the Symbol property.Runtime probe output (injected into
dsh-agent-loop/lib/index.jsstartCall):And the ToolRuntime constructor probe:
while agent-loop resolves:
Repro
@deepseek-ai/dsh-toolsto the web profile (e.g.@anweat/dsh-browser).dsh-toolsinto~/.dsh/profiles/web/node_modules.dsh weband ask the agent to do anything that requires a tool.A service started before the hoisted copy exists (or one that stays running) is unaffected — which made this look like a "restart broke it" issue.
Suggested fixes (any one would resolve it)
TOOL_RUNTIME_SCHEDULER = Symbol("...")toSymbol.for("...")(global registry) — smallest change, survives duplicate module instances.@deepseek-ai/dsh-toolsas a peerDependency for profile plugins and add a startup duplicate-instance detection with a clear error message.@deepseek-ai/dsh-*packages preferentially from the main package's node_modules.Thanks for the great tool — happy to provide the full session log if useful.
中文版
环境
0.1.0-rc.6(npm 全局安装,npx @deepseek-ai/dsh web启动)~/.dsh/profiles/web,装有第三方插件@anweat/dsh-browser@0.1.3和dsh-find-plugin@0.3.6症状
所有工具调用(Glob、read、pwsh——任何工具)都会立即失败,轮次以如下错误结束:
之后发送的任何消息都会失败:
服务启动正常、界面渲染正常——只有工具执行是坏的。
根因:dsh-tools 被加载了两份(模块实例重复)
TOOL_RUNTIME_SCHEDULER是模块内的Symbol("...scheduler")。同一进程内最终加载了两份物理副本@deepseek-ai/dsh-tools:dsh-agent-loop从主包嵌套的 node_modules(npm 全局安装)解析@deepseek-ai/dsh-tools;ToolRuntime却是从 profile 目录里被提升(hoist)的副本构造的(~/.dsh/profiles/web/node_modules/@deepseek-ai/dsh-tools)——pnpm 因为第三方插件依赖 dsh-tools 而把它提升到了 profile。每份副本各自创建自己的 Symbol。描述相同但身份不同,因此运行时
ctx.tools[TOOL_RUNTIME_SCHEDULER]是undefined——即使实例上确实存在这个 Symbol 属性。运行时探针输出(注入到
dsh-agent-loop/lib/index.js的 startCall):ToolRuntime 构造函数探针:
而 agent-loop 解析到的是:
复现步骤
@deepseek-ai/dsh-tools的第三方插件(例如@anweat/dsh-browser);dsh-tools提升到~/.dsh/profiles/web/node_modules;dsh web,让 agent 执行任何需要工具的操作。在提升副本出现之前启动的服务(或一直保持运行的服务)不受影响——这使问题看起来像是"重启后就坏了"。
建议修复(任选其一即可解决)
TOOL_RUNTIME_SCHEDULER = Symbol("...")改为Symbol.for("...")(全局注册表)——改动最小,可经受模块重复实例;@deepseek-ai/dsh-tools声明为 profile 插件的 peerDependency,并在启动时检测重复实例、给出清晰报错;@deepseek-ai/dsh-*系列包。感谢这个优秀的工具——如需完整会话日志,随时可以提供。
All reactions