Repository navigation
[BUG] 工具执行中途崩溃后会话永久卡死:DeepSeek 400 "insufficient tool messages"(rc.6) #1695
Unanswered
2661027052
asked this question in
Q&A
Replies: 1 comment 2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
问题描述
某轮对话中,助手刚输出一个工具调用(
todo_write),工具执行阶段随即崩溃,该轮报错:崩溃之后这个会话彻底废了:之后无论发什么消息,每一轮都在第一步直接失败,报:
一次中途崩溃 = 会话永久卡死,只能放弃该会话。
复现步骤
dsh web开启会话,正常跑任务(环境:Windows 11 / Node v24.15.0 / 模型 deepseek-v4-pro)undefined.prepare),该轮以 UNKNOWN 错误结束实际行为
崩溃后会话历史里残留一条没有工具结果的 assistant tool_calls,dsh 不做任何修复(不补合成结果、不裁剪悬空消息),把残缺历史原样发给 API,DeepSeek 严格校验直接 400,会话永久无法继续。
期望行为
崩溃后会话应当可恢复:为未应答的工具调用补一条合成错误结果(类似已有的 "tool call aborted before dispatch" 处理),或裁剪悬空的 assistant 消息。至少后续消息不应再触发 API 400。
环境信息
dsh web日志与证据
崩溃那一轮(step 1)的会话事件序列:
assistant/messagetool/callcallId: call_00_BNK32bokg9LKRgMdRwlY8298,name: todo_writestep/endturn/endreason: {"kind":"error","error":{"message":"Cannot read properties of undefined (reading 'prepare')","code":"UNKNOWN"}}注意:该
todo_write调用自始至终没有对应的tool/result事件。之后连续三轮(25、26、27)每轮都是同一模式:
turn/startuser/messageassistant/chunkINVALID_REQUEST、status: 400turn/end根因分析(AI 分析)
undefined.prepare对应dsh-agent-loop中ctx.tools[TOOL_RUNTIME_SCHEDULER].prepare(...)。同一时刻ctx.tools.executionMode()正常,说明 tools 服务还在,但 Symbol 键的调度器属性变成 undefined。崩溃发生在运行中热加载插件之后,怀疑 HMR 模块重载后dsh-agent-loop与ToolRuntime之间的 Symbol 引用对不上。appendSkippedToolCall的合成结果逻辑只覆盖中止场景,不覆盖调度器抛异常场景),悬空的 tool_calls 被dsh-llm-deepseek原样序列化发给 API。All reactions