|
分类: Bug 反馈 问题概述所有面向模型的工具调用(bash、jobs、fs、web、todo、subagent、ralph、workflow——全部)都能被模型正确选中,但一执行就崩溃: 工具已注册、模型能看到(它会用正确参数调用 复现步骤
观察到的现象
根因分析(源码级)Agent 循环通过
const prepared = await ctx.tools[TOOL_RUNTIME_SCHEDULER].prepare(call.exec);
调度器是 ToolRuntime 服务的类字段:
[TOOL_RUNTIME_SCHEDULER] = {
prepare: (exec) => this.prepareScheduledExecution(exec),
dispatch: (exec) => this.dispatchScheduledExecution(exec),
finalize: (exec, result) => this.finalizeScheduledExecution(exec, result),
finish: (exec, result) => this.finishScheduledExecution(exec, result)
};服务以 如果
我们试过的方法(均无效)
给维护者的额外发现
预期行为
非常乐意提供日志 / 会话 JSONL / 配合跑诊断。感谢这个 harness,期待 rc.7!🙌 |
Replies: 6 comments 1 reply
|
先给结论:你的复现质量很高,但机制结论需要修正——源码证据不支持"ToolRuntime 未被实例化 / systemPrompt 注入失败导致残缺 tools 服务"的假设;这个报错更可能是我们已知家族的第四次报告(#1337、#1633、#1665 同签名),而干净安装能复现恰恰说明这次是发布打包层面的变体。 1. 源码证据:ctx.tools 能解析 ⇒ 它必然是 ToolRuntime 实例
2. 干净安装为什么会有两份拷贝(打包层面,已核实)
3. 决定性诊断(请在 rc.6 机器上跑,30 秒定位) # 找到应用闭包里的 dsh-tools 拷贝数
find ~/.npm/_npx -type d -name dsh-tools 2>/dev/null
# 在 profile 目录看 dsh-tools 是否是符号链接、指向哪
ls -la ~/.dsh/profiles/web/node_modules/@deepseek-ai/ | grep dsh-tools
# 关键:两个解析点是否命中同一物理文件
node -e "
const path=require('path');
const fs=require('fs');
const fromLoop=require.resolve('@deepseek-ai/dsh-tools',{paths:[path.dirname(require.resolve('@deepseek-ai/dsh-agent-loop/package.json'))]});
const fromBash=require.resolve('@deepseek-ai/dsh-tools',{paths:[path.dirname(require.resolve('@deepseek-ai/dsh-tool-bash/package.json'))]});
console.log('loop ->', fromLoop);
console.log('bash ->', fromBash);
console.log('same path:', fromLoop===fromBash, '| same realpath:', fs.realpathSync(fromLoop)===fs.realpathSync(fromBash));
"若两个 realpath 不同 → 两拷贝实锤,机制确认。若相同 → 排除拷贝机制,我再帮你从 loader 的条目解析顺序查(那就要看 rc.6 实际发布树了)。 4. 你观察里另两个点
5. 家族连接 + 修复方向 四次报告(#1337 Windows+插件、#1633 Windows+插件、#1665 Windows、#1677 干净安装)同签名。两个既有 PR 蓝图( |
|
ToolRuntime 调度器未注册——和 #1515/#783 是同一族(dsh-tools 相关:插件安装/依赖解析后工具调度器状态异常)。 排查:确认 dsh-tools 只存在一份(无二次 materialize),必要时清 npm 缓存重装。完整机制见第 3 章:https://github.com/Electricitysheep/dsh-handbook/blob/main/docs/03-profiles.md |
|
补充一条来自社区整理的打包侧修复建议(与上方三拷贝诊断对应): 根因(打包层面)
建议修复方向(三条可选,可叠加)
如果需要,社区可以把第 1 条(dsh-base package.json 依赖声明)整理成可直接合并的 PR。 |
|
补充:第 1 条修复(dsh-base 的 dsh-tools 依赖改 peer)已整理为可合并的 commit,供维护者直接取用(本仓库禁用了 PR 功能,故以分支形式提供):
如采纳,直接 cherry-pick 或合并该分支即可。 |
|
@argszero @Electricitysheep 您好,关于本贴的 undefined.prepare 问题,社区已将打包侧修复整理为可直接合并的 commit,正式请求官方采纳: 修复内容将 取用方式(任选其一)
已验证
后续建议
感谢团队排查,期待合并。 |
|
@argszero @Electricitysheep Request to the maintainers: please enable the Pull Request channel for this repository. We have a ready-to-merge fix for this exact issue (undefined.prepare / duplicate TOOL_RUNTIME_SCHEDULER copies):
Currently the repository has Pull Requests disabled ( Thank you! |
先给结论:你的复现质量很高,但机制结论需要修正——源码证据不支持"ToolRuntime 未被实例化 / systemPrompt 注入失败导致残缺 tools 服务"的假设;这个报错更可能是我们已知家族的第四次报告(#1337、#1633、#1665 同签名),而干净安装能复现恰恰说明这次是发布打包层面的变体。
1. 源码证据:ctx.tools 能解析 ⇒ 它必然是 ToolRuntime 实例
super(ctx, 'tools')(packages/core/tools/src/index.ts:827)——没有第二个服务用 'tools' 名字注册,不存在"残缺 tools 服务"。readonly [TOOL_RUNTIME_SCHEDULER]: ToolRuntimeScheduler = {...})——只要 ToolRuntime 被构造,字段必然存在,与 systemPrompt 注入无关。ctx.tools解析成功 +ctx.tools[TOOL_RUNTIME_SCHEDULER]为 undefined 只剩一种机制:ctx.tools 是另一份物理拷贝的 dsh-tools 构造的实例。TOOL_RUNTIME_SCHEDULER是 unique symbol(tools/src/index.ts:466),每份拷贝在磁盘上求值都得到不同的 Symbol 实例——agent-loop 用自己拷贝的 Symbol 去索引外来拷贝实例的字段 → undefined →undefi…