Skip to content

messagesToCC 对缺 source 的消息空解引用,整条 stream 序列化阶段 TypeError(0.11.2) #47

Description

@heptaspirit

在用 dsh-mneme 的记忆管线走 commandcode 路由时踩到的:插件自己拼的 LLM 消息如果漏了 source 字段,messagesToCC 里这四处会直接空解引用——

if (message.role === "user" && message.source.kind !== "tool")

(npm 0.11.2 的 lib/index.js 2966 / 3009 / 3078 / 3124,同一写法)

表现是整条 stream 在序列化阶段同步抛 TypeError: Cannot read properties of undefined (reading 'kind'),0–8ms、请求根本没发出去,报错里看不出是哪里的问题,排查花了一阵。

背景:source 在 dsh-llm 的类型注释里是必填("Required source fields supplied by the producer"),但运行时没校验,官方的 dsh-llm-deepseek 适配器又不读它,所以消息生产方漏了字段也能长期正常跑——commandcode 应该是第一个认真读这个字段的适配器。我们已经在消息生产方修掉了(modusensus/dsh-mneme#189,PR #190 已合),mneme 侧不会再触发。

小建议:这四处改成 message.source?.kind 的话,缺字段只是当普通 user 消息处理(试过 user 分支只读 content blocks,不会牵出别的问题),而不是整条流挂掉——其他第三方插件的同类手误也能兜住。

环境:@mars-sea/dsh-commandcode-provider@0.11.2 · dsh-llm 0.1.5-rc.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions