Repository navigation
Replies: 6 comments
|
Follow-up on the same root cause — this explains a second, downstream symptom. The callSeqs[index] = appendToolCall(session, turn, step, call.block); // persisted first
started++;
const prepared = await ctx.tools[TOOL_RUNTIME_SCHEDULER].prepare(call.exec); // throws hereSo every tool call that hit Consequences:
So the two symptoms ( Additional fixes for the list:
|
|
我的设备上也遇到了相同的问题,让D老师看过上面的分析后写了一个给Windows设计的修复脚本(只在Windows11+pwsh 7测试过可用,pwsh 5大概会因为编码问题报错。。没试过): |
|
工具调用类报错(含流式下工具名丢失/description 字段 required 死循环)我们在 FAQ 和第 8 章整理了根因与规避,可对照排查:https://github.com/Electricitysheep/dsh-handbook/blob/main/docs/faq.md |
|
@deepseek-ai/dsh-tools 被 materialize 两次(profile pnpm install 后)——这和"插件装在哪决定依赖解析"是同一机制:dsh 的扁平兜底目录($DSH_HOME/profiles/node_modules 软链接)让 Node 在 profile 内可解析到宿主包,但 profile 里再 install 会生成第二份。 完整机制 + 规避(link 开发依赖声明/版本线锁定)见手册第 3 章:https://github.com/Electricitysheep/dsh-handbook/blob/main/docs/03-profiles.md |
|
写得很清楚,我们在 Windows 上也踩了同一个坑,独立定位到同样的 Symbol 分裂机制。这个帖子缺了一块:插件侧的根治方案——我们端到端验证过,比事后清副本便宜得多。 修复:外部 bundle 插件的 dsh 依赖必须声明为 peerDependencies,不能是 dependencies。 复现环境:@deepseek-ai/dsh@0.1.0-rc.6(全局 npm 安装)、Node 24.18、Windows 11、profile headless + 一个注册了单个工具的外部插件。 坏:插件 package.json 把 @deepseek-ai/dsh-tools(和 @deepseek-ai/cordis)放在 dependencies。dsh plugin --profile headless add file:... 后,pnpm 在 ~/.dsh/profiles/headless/node_modules/@deepseek-ai/dsh-tools 生成第二份副本。任何工具调用——包括内置的 filesystem——都崩:dsh: UNKNOWN: Cannot read properties of undefined (reading 'prepare')。(我们还确认:即使不调用自定义工具也会崩,因为 agent-loop 从安装树解析自己的 dsh-tools,而 tools 服务由 profile 副本提供——副本的存在本身就破坏调度。) 文档缺口(建议官方修):extension cookbook 是第三方插件作者唯一会读的文档,却对依赖声明只字未提。唯一的书面提及在仓库内包清单(adding-a-package.md),且只规定规则、不讲原因;机制只存在于源码注释(dsh-app-boot 的 healProfilesModuleFallback)。建议在 cookbook 补一小段:"外部 bundle 插件必须把 @deepseek-ai/* 依赖声明为 peerDependencies;安装重复副本会破坏模块级单例(如调度器 Symbol),导致所有工具调用失败。 |
|
来自DS酱的回答: 在另一条触发路径上复现了同样的问题,另外补充同一设计缺陷的第二个实例。 环境
也就是说,原报告中的触发条件("在 profile 内执行 现象会话日志中 24 轮里有 9 轮以同一个错误终止: 而你在后续评论里描述的"孤立记录"特征完全吻合 —— 每次工具调用都落盘了,却没有一次配对: 在这份 224 条记录的会话中,不存在任何形态的 本机上并非"物理副本重复"checkout 下存在 75 个 对源码 checkout 而言最合理的解释是:同一个包被以两种模块形态加载 —— 加剧因素:扁平兜底目录从未被创建你指出 即在该配置下 同类缺陷:
|
Uh oh!
There was an error while loading. Please reload this page.
Summary
Every tool call in every session fails with
Cannot read properties of undefined (reading 'prepare')after runningpnpm installinside a profile directory. Root cause:@deepseek-ai/dsh-toolsgets materialized twice — once in the installation tree, once in the profile'snode_modules— which splits its module-level schedulerSymbolinto two distinct objects.Environment
@deepseek-ai/dsh@0.1.0-rc.6, installed globally vianpm i -g @deepseek-ai/dshweb, with out-of-tree plugins added viadsh plugin add/pnpm installReproduction
web) and add any out-of-tree plugin that hard-depends on@deepseek-ai/dsh-tools(e.g.dsh-better-sidebar,@omdsh-dev/dsh-genui,@dsh-external/dsh-automation).pnpm installinside the profile directory.pwd).Observed behavior
The
turn/endevent records:{"reason":{"kind":"error","error":{"message":"Cannot read properties of undefined (reading 'prepare')","code":"UNKNOWN"}}}Every tool call dies at scheduler dispatch, for all sessions.
Root cause
dsh-agent-loopreaches the tool scheduler through a module-levelSymbol:TOOL_RUNTIME_SCHEDULERisSymbol("@deepseek-ai/dsh-tools.scheduler")(dsh-tools/lib/index.js:2409). It must be the same object everywhere in the process.The flat fallback
~/.dsh/profiles/node_modules(maintained byhealProfilesModuleFallback) correctly symlinks each@deepseek-ai/*package back to the installation tree, keeping the symbol a singleton — as long as the profile has no local materialization.Running
pnpm installinside a profile (whichdsh pluginforwards to pnpm) materializes@deepseek-ai/dsh-toolsand other in-box packages as physical copies under~/.dsh/profiles/<name>/node_modules/@deepseek-ai/. Any out-of-tree plugin that hard-depends on@deepseek-ai/dsh-toolsthen resolves to this profile-local copy, whoseSymbolis a different object from the installation tree's.Result:
dsh-agent-loop(installation tree) uses symbol A to look upctx.tools[symbolA], but the profile-localdsh-toolscopy produced symbol B, so the lookup yieldsundefinedand.preparethrows.Direct proof (both copies at 0.1.0-rc.6, byte-identical contents):
Why this is a design bug rather than a plugin bug
Symbolwith no guarantee against multiple copies.dsh pluginforwards topnpm, andpnpm installmaterializes in-box@deepseek-ai/*packages into the profilenode_modules, breaking the singleton assumption.webprofile manifest itself lists@deepseek-ai/dsh-toolsindependencies, so this reproduces even with zero third-party plugins, as long aspnpm installis run in the profile.Cannot read properties of undefinedwith no hint about the duplicate copy.Suggested fix direction
Symbol.for("<well-known-key>"), or a plain string key), or@deepseek-ai/*packages to the installation tree (declare them aspeerDependencies/external in the profile build, or dedupe them back to the fallback symlink), orctx.tools[TOOL_RUNTIME_SCHEDULER]lookup and emit a clear diagnostic like "multiple copies of @deepseek-ai/dsh-tools detected; remove profile-local @deepseek-ai packages and re-run".All reactions