Community plugins resolving a second @deepseek-ai/dsh-tools copy crash the tool scheduler with Cannot read properties of undefined (reading 'prepare') #1337
Replies: 2 comments
|
Thanks for the excellent root-cause write-up — I verified it against the current master source and your diagnosis holds up. Here's the source-level confirmation plus some practical mitigations. Source confirmation (current master)
The key subtlety:
Practical mitigations
The un-resumable session gapThat's a second, independent robustness issue: agent-loop commits Happy to help draft that feature request if useful. Thanks again for the detailed report — this is exactly the kind of cross-plugin failure mode that's hard to reproduce without a full environment listing like yours. |
|
Update after deeper forensics ? we found the shadowing mechanism that makes this intermittent: The profile keeps a module map ( Because the profile-level map shadows the shared pool for host module resolution, After removing the stale plugins, the map has no dsh-tools entry at all and resolution falls back to the shared pool's 0.1.0-rc.6 copy ? the crash is gone. Suggestion stands: fail loudly (or never shadow) when a profile hoists a second copy of a runtime package that the harness itself owns, and surface the offending plugin row at load time. |
Uh oh!
There was an error while loading. Please reload this page.
Environment
0.1.0-rc.6(fresh npm install), Windows 11, web profile.nodeLinker: hoisted).dsh-pdf,dsh-weather,dsh-tool-git,@openbiliclaw/dsh-plugin,dsh-chat-import,dsh-context-doctor(plus pure client/utility plugins).Symptom (intermittent)
The first tool call of a turn crashes the whole turn with:
(
code: UNKNOWN, fromdsh-agent-loop). No tool results are appended, so the session history keeps an assistant message withtool_callsand no following tool messages. Every subsequent turn then fails at the API with:Disabling all community plugins and restarting eliminates the crash (56+ tool calls since, zero failures). The two affected sessions are permanently un-resumable because of the dangling
tool_calls.Root cause
dsh-agent-loop/lib/index.js:193reads:TOOL_RUNTIME_SCHEDULERis a per-moduleSymbol("@deepseek-ai/dsh-tools.scheduler"). The profile's hoistednode_modulesresolves its own@deepseek-ai/dsh-tools@0.0.1-rc.1(satisfying several plugins'^0.0.1-rc.1ranges). In that older ABI line the registry class isToolRegistryand the field is keyed by the oldTOOL_REGISTRY_SCHEDULERsymbol — same description string, differentSymbolinstance. One plugin (dsh-context-doctor@0.5.0) additionally bundles a complete secondToolRuntime(class extends Service { super(ctx, "tools") }) with its own local symbol.When the agent scope's
toolsresolution lands on an instance minted by a foreign copy, the symbol lookup yieldsundefinedand the scheduler crashes. Profile-loaded plugins bypass theharness.defineToolmarker guard that dynamic packages receive, so nothing rejects the alien runtime copy at load time — the failure surfaces hours later, at dispatch, with an opaque message, and silently corrupts session history.Suggested fix
A load-time guard on the profile plugin loader that:
@deepseek-ai/dsh-toolsmodule instance in the plugin's resolution tree (or asserts the resolvedtoolsservice carries the expected scheduler symbol), andinstead of a delayed runtime crash that also poisons session history.
Evidence bundle
Repro config (profile
package.json+cordis.patch.yml), resolved dependency map (.modules.yaml), and the two affected session logs are available; happy to attach.All reactions