Repository navigation
Replies: 2 comments
|
Confirmed, and your root-cause analysis is exactly right. The multi-hour bisect was earned by the diagnostic, not by the bug being subtle β FixThe key crosses a package boundary β the agent loop reads export const TOOL_RUNTIME_SCHEDULER: unique symbol = Symbol.for('@deepseek-ai/dsh-tools.scheduler')
Why the second-order damage is worse than the firstWorth emphasising the part your report notes at the end. It is not just that the call fails β the turn appends Tests worth havingTwo, because the obvious one is not enough: expect(TOOL_RUNTIME_SCHEDULER).toBe(Symbol.for('@deepseek-ai/dsh-tools.scheduler'))and one that actually resolves the live service through a key minted the way a duplicate copy would mint it β holding only a plain const foreignKey = Symbol.for('@deepseek-ai/dsh-tools.scheduler')
const scheduler = (ctx.tools as unknown as Record<symbol, { prepare?: unknown }>)[foreignKey]
expect(typeof scheduler?.prepare).toBe('function')Both fail on a module-local Who is most exposedAnyone installing the harness as packed tarballs into a profile, which is the shape that most easily duplicates a transitive copy β particularly if any package declares an unbounded peer range that can resolve to two versions in one tree. #4667 is an independent report of the same failure. |
|
This thread is the canonical write-up of a failure I have now cited on two other threads this week, so let me add three things: one caution on the proposed fix, one detection recipe that works today, and one pointer to a tool that will mass-produce this state. 1. @nokkies's argument β the const is exported, so It came up on #1697, where @moonquake2004 made the point better than I had: a module-local Your own resolution trace is the reason this is not hypothetical here: you found three distinct instances in one tree, and a profile that resolves its own copy is exactly the situation where those copies are different versions rather than the same one duplicated. So the shape I would argue for is 2. A detection recipe that works today, no fix required. For anyone who lands here mid-bisect: the invariant is that a profile should not resolve any # should print nothing
find "<profile>/node_modules" -maxdepth 4 -path '*/@deepseek-ai/dsh-agent' -printWe assert two things per run β that the CLI tree's core version matches the CLI spec, and that the profile resolved no core copy of its own β precisely because a profile-local copy shadows the CLI's core. Same check works for 3. A tool that will produce this state in volume. #4698 announces a launcher that creates multiple DSH instances and profiles with per-instance version selection. That is the single most efficient way to end up with two core versions in one tree. I have left the same warning there; worth cross-linking so the two threads find each other. One more consequence of yours worth keeping prominent, because it changes severity: the session is left with Interest disclosure: I maintain a third-party DSH plugin, so I ship into profiles and this failure mode is one I have to design around. |
Uh oh!
There was an error while loading. Please reload this page.
If any package under a profile's
node_modulesbrings its own copy of@deepseek-ai/dsh-tools, every tool call in that profile fails:The scheduler handle is keyed by a module-local
Symbol(), so two copies ofdsh-toolsyield two non-equal keys and the lookup returnsundefined. Nothing fails at load time, the message names neither the tool nor the duplicated package, and it also fires from orphaned packages the profile no longer references.Impact
tool_callsbut never the matching results, so the next request fails upstream withAn assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The conversation has to be abandoned.Root cause
TOOL_RUNTIME_SCHEDULERis a module-local symbol:It is exposed as an instance property of the
ToolRuntimeservice (dsh-tools/lib/index.js:2564; declared indsh-tool-cordisasreadonly [TOOL_RUNTIME_SCHEDULER]: ToolRuntimeScheduler) and read back by the agent loop:Since
Symbol()(notSymbol.for()) is identity-scoped per module instance, writer and reader must resolve to the samedsh-toolsfile. A profile-local copy breaks that.Resolution on my machine β three distinct instances:
I did not instrument which instance ends up owning
ctx.tools; the duplication plus theSymbol()identity rule is enough to explain theundefined.Reproduction
{ "name": "my-plugin", "dependencies": { "@deepseek-ai/dsh-tools": "^0.1.1-rc.2" } }dsh plugin --profile <name> add my-pluginβ a copy lands in<profile>/node_modules/@deepseek-ai/dsh-tools.Cannot read properties of undefined (reading 'prepare').The part that makes it much worse
The duplicate does not need to be referenced by the profile. My
headlessprofile had:{ "dependencies": {}, "dsh": { "profile": { "bundles": ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-headless"] } } }Empty dependencies, and the offending plugin was not in
bundlesβ only a leftovernode_modules/@deepseek-ai/tree from an earlier install. Tool calls still failed on every turn.Moving that orphaned directory aside fixed it immediately, with no other change:
So uninstalling the plugin isn't enough β a stale
node_moduleskeeps the profile broken, with no configuration anywhere hinting why.Suggestions
Roughly in order of value:
realpathevery resolved@deepseek-ai/*package and throw if one resolves to more than a single path. This matches the stance the codebase already takes elsewhere βdsh-credentials-localrejects rather than skips, reasoning that "a silently ignored entry reads as 'the credential I stored has no effect'". A duplicated runtime package is the same class of failure, with a much wider blast radius.Symbol.for("@deepseek-ai/dsh-tools.scheduler"). Cheap, and downgrades a hard failure to a merely-redundant install. Best combined with (1) so duplication still gets reported.dsh-contextgets it right βdependencies: {}, with every@deepseek-ai/*package plusreact/zodunderpeerDependenciesβ but I couldn't find this written down anywhere, so it reads as a style choice rather than a hard requirement. A line in the plugin docs, plus a warning fromdsh plugin addwhen a plugin declares a@deepseek-ai/*package as a non-peer dependency, would prevent the entire class.I know external PRs aren't being accepted right now β happy to provide any further detail or to verify a fix against my setup if that's useful.
Environment
@deepseek-ai/dsh~/.dsh/profiles/{web,headless}All reactions