Bug report draft: native read_image tool fails with "cannot get property 'fs' without inject" (all presets) #4612
Replies: 2 comments 2 replies
|
定位很干净,而且你把"为什么只有 补两件。 一、这个 bug 的形状值得单独说:守卫在执行期才响,所以它通过了所有挂载期检查这条链上每一步看起来都是健康的:
也就是说:一个 scope 声明错误的注册,能通过全部的启动期检查,只在被使用时才暴露。而代价是模型白白花掉一整轮——它不知道这个工具坏了,只知道调用失败了。 这个形状最近在这个社区里反复出现,成因各不相同但后果一样:
共同点:"挂载/组合成功"这个信号,不保证注册的东西真的可用。 你这条是其中症状最良性的一个——因为 cordis 的报错明确点名了缺哪个服务( 二、你的两个修法里,我倾向你给的第一个(把外层
|
|
The source diagnosis still applies at current rc.2 ( A regression should call the tool obtained from the fully composed
I also separated this injection failure from the six adjacent I did not independently reproduce the Windows binary failure; that evidence remains attributed to this report. I independently verified the rc.2 source call site. Disclosure: I maintain the independent community handbook linked above. |
Uh oh!
There was an error while loading. Please reload this page.
Environment: dsh 0.1.0-rc.6, Windows, web profile. Reproduces on
freedom(user preset) and should reproduce on every preset mounting@deepseek-ai/dsh-tool-fs, since the defect is in the package itself.Symptom
Calling the native
read_imagetool fails immediately:read,write, andeditwork normally — onlyread_imagefails. The image file is irrelevant.Root cause
In
@deepseek-ai/dsh-tool-fs/lib/index.js,apply()registersread_imageinside an attachments-gated sub-context and passes that sub-context down:
But
applyReadImageTool's execute body dereferencesctx.fs.readBytes(...)(and registers through
ctx.tools.register(...)) as a property access. Cordis'sguard throws on undeclared service-property access, so execution dies with
cannot get property "fs" without inject.The function's own doc comment states the intended contract:
i.e. the caller was supposed to pass the outer scope; the call site passes the
narrowed accessor instead. Note the body already handles the optional services
correctly via runtime lookups (
ctx.get("attachments"),ctx.get("llm")) —only the declared-service property accesses (
fs,tools) are affected.Suggested fix (one line at the call site)
The outer
ctxdeclarestools+fs;attachmentsremains a runtimectx.get(). Registration timing is unchanged (still gated onattachmentsbecoming available). Alternatively, widen the inner inject to
["attachments", "fs", "tools"]— either satisfies the guard.Workaround in the wild
Routing image reads through an external vision CLI (e.g. modlens) sidesteps the
DSH tool pipeline entirely, which is how we noticed only
read_imagewasaffected while sibling fs tools stayed healthy.
All reactions