Replies: 6 comments 2 replies
|
牛逼啊 |
|
试过了,macos 下似乎无效 |
|
我在 Windows 11、当前 除恢复源码启动的 export const TOOL_RUNTIME_SCHEDULER: unique symbol = Symbol.for('@deepseek-ai/dsh-tools.scheduler')我本地增加了: expect(Symbol.keyFor(TOOL_RUNTIME_SCHEDULER)).toBe('@deepseek-ai/dsh-tools.scheduler')验证情况:
我先前发布的 #7015 描述的是 HMR 触发路径;现确认它与本讨论重复,将其关闭并把后续信息集中在这里。 I reproduced the same Using |
汇总结论与完整修复方案近期这些报告属于同一故障族,但有三种触发路径:
三者最终都在这里失败: ctx.tools[TOOL_RUNTIME_SCHEDULER].prepare(call.exec)
用户立即恢复办法
上游修复 1:源码和产物保持单一模块平面源码启动应默认 const packaged = (process as NodeJS.Process & { pkg?: unknown }).pkg !== undefined
const sourceLaunch = import.meta.url.endsWith('.ts')
const defaultResolutionMode: ProfileResolutionMode = sourceLaunch ? 'link' : 'runtime'
const resolutionMode = packaged ? 'runtime' : options.resolutionMode ?? defaultResolutionMode这比无条件改回
上游修复 2:跨模块实例共享 scheduler 键export const TOOL_RUNTIME_SCHEDULER: unique symbol
= Symbol.for('@deepseek-ai/dsh-tools.scheduler')这项硬化同时覆盖 profile 重复包和 HMR。它不能修复整个重复模块图中所有 上游修复 3:启动时检测重复核心模块profile resolution / plugin install 完成后,应从 installation anchor 和每个 profile/plugin resolution anchor 解析关键核心包并比较
插件管理器安装完成后也应执行同一检查。 上游修复 4:在写入 tool/call 前取得 scheduler当前流程先写 const scheduler = ctx.tools[TOOL_RUNTIME_SCHEDULER]
if (scheduler === undefined) {
throw new ToolRuntimeSchedulerUnavailableError(/* include resolved package paths */)
}这样至少把错误变成可行动的 typed error,并确保该错误不会产生悬空 必须增加的回归门禁
本地验证我在 Windows 11 当前 checkout 上应用了前两项代码修改:
相关报告包括 #4529、#4601、#6416、#6529、#6967、#6974、#6975、#6992、#6994、#6996 和 #7011。建议把本讨论作为 0.1.6-alpha.2 源码启动回归的集中跟踪入口。 English summary: this is one failure family with three triggers: source/artifact plane mixing, profile-local duplicate core packages, and HMR re-evaluation. The complete fix is to (1) default TypeScript source launches to |
|
我们独立复现并定位了同一问题:profile 的 ESM 后备解析把 pnpm 符号链接下的 最小修复(把该锚点规范化为真实路径)+ 回归红绿测试 + 有/无构建产物(A/B)与端到端复测见 #7048。该修复不依赖把默认 mode 改回 |
|
复制以下文本给Agent用来修复此问题 任务:修复 dsh 源码启动下所有工具调用崩溃(
|
Uh oh!
There was an error while loading. Please reload this page.
环境
ddefc45fbc(0.1.6-alpha.2)pnpm dsh headless "..."与pnpm dsh web均可复现(内置 headless 与自定义 web profile 均受影响)复现
ddefc45fbc并pnpm installpnpm dsh headless "用 bash 工具执行 echo hi"(或pnpm dsh web后在会话里调用任意工具)无需新写测试,仓库自带的 keyless 回放场景即可复现:
实际行为
CLI 输出:
会话日志中
tool/call之后紧跟turn/end:{"reason":{"kind":"error","error":{"message":"Cannot read properties of undefined (reading 'prepare')","code":"UNKNOWN"}}}bash-tool-turn快照场景在ddefc45fbc上直接红:根因
提交 9ddef327a4(随 0.1.6-alpha.2 发布)把非 packaged 启动的默认解析模式从
link改为runtime(profile-boot.ts#L263)。在 tsx 源码启动下:
paths把裸导入@deepseek-ai/dsh-tools映射到packages/core/tools/srcexports加载插件入口 →lib/dsh-tools;TOOL_RUNTIME_SCHEDULER是unique symbol,两份各有一个描述相同但对象不同的 symbolctx.tools[TOOL_RUNTIME_SCHEDULER].prepare(...)取到undefined,所有工具调用崩溃插桩证据:
期望行为
默认源码启动下工具调用正常执行(9ddef32 之前默认
link时正常)。建议修复
最小修复:非 packaged 的默认值改回
'link'(本地验证bash-tool-turn由红转绿):治本方向:让 runtime generation 与 tsx 的
paths投影落在同一模块平面(源码启动解析到src),避免同一包在 src/lib 两个平面各实例化一次。另外建议把
bash-tool-turn(或同类真实工具调用场景)纳入源码启动/发布的必过门禁——本次发布显然漏掉了它。(注意到 CONTRIBUTING 说明暂不接受外部 PR,故在此附上可复现证据与补丁,供团队参考采纳。)
Title
[Bug] Source launch defaults to runtime resolution mode, loading
dsh-toolstwice and breaking every tool call withCannot read properties of undefined (reading 'prepare')Environment
ddefc45fbc(0.1.6-alpha.2)pnpm dsh headless "..."andpnpm dsh web; both shipped headless and a custom web profile reproduceReproduction
ddefc45fbcand runpnpm installpnpm dsh headless "run echo hi via the bash tool"(orpnpm dsh weband call any tool)No new test needed — the repo's own keyless replay reproduces it:
Current behavior
CLI output:
The session log shows
tool/callimmediately followed byturn/end:{"reason":{"kind":"error","error":{"message":"Cannot read properties of undefined (reading 'prepare')","code":"UNKNOWN"}}}The
bash-tool-turnsnapshot is red onddefc45fbc:Root cause
Commit 9ddef327a4 (shipped in 0.1.6-alpha.2) changed the non-packaged default resolution mode from
linktoruntime(profile-boot.ts#L263).Under the tsx source launch:
pathsresolves bare@deepseek-ai/dsh-toolstopackages/core/tools/srcexports→lib/dsh-toolsend up in one process;TOOL_RUNTIME_SCHEDULERis aunique symbol, so each copy has a distinct symbol object with the same descriptionctx.tools[TOOL_RUNTIME_SCHEDULER].prepare(...)at tool-calls.ts#L170 isundefined, crashing every tool callInstrumentation evidence:
Expected behavior
Tool calls succeed under the default source launch (they did with the previous
linkdefault, before 9ddef32).Suggested fix
Minimal fix: restore
'link'as the non-packaged default (verified locally:bash-tool-turngoes red → green):Proper fix: keep the runtime generation and the tsx
pathsprojection on a single module plane (source entries for source launches) so a package is never instantiated from bothsrc/andlib/.Also suggest gating source launches/releases on
bash-tool-turn(or an equivalent real-tool-call scenario) — this release clearly missed it.(Noted CONTRIBUTING states external PRs are not accepted at the moment; posting the reproduction and patch here for the team to consider.)
All reactions