Repository navigation
[Bug] deepseek-flash 将 DSML 工具调用标记混入 tool input JSON,导致 turn 以 MALFORMED_RESPONSE 中止 #9848
Replies: 2 comments 1 reply
|
更新:找到一个可行的缓解手段,本会话已恢复正常输出。 缓解方法:
|
Where that error comes from, why the one obvious tolerance patch is already half-written, and why no plugin can fix itYour diagnosis holds up against the source. Two things I can add that may change what you ask for: the harness already contains the policy you are asking for, in a branch one condition away — and the seam that looks like it could patch this from outside provably cannot. 1. The error is raised by the provider translator, not by the tool layer
function malformed(detail: string): never {
throw new LlmError(`DeepSeek Messages stream: ${detail}`, 'MALFORMED_RESPONSE')
}and the throw you are seeing is // Truncated tool JSON is retained in the stream, then pruned by the shared assembler.
if (reason.kind !== 'max-tokens') {
for (const { content } of blocks.values()) {
if (content.type !== 'tool-call') continue
let parsed: unknown
try { parsed = JSON.parse(content.arguments) } catch (_invalidProviderToolJson) { return malformed('tool input is invalid JSON') }
object(parsed)
}
}Three consequences worth naming:
2. The harness has no notion of DSML — and that defines the cost of any repair
3. The tolerance you are asking for is already in the tree — under a different conditionLook again at That reframes your option 2: this is not a missing capability, it is a policy boundary. The current rule is "unparseable arguments are survivable when the model ran out of room, fatal otherwise". A DSML-contaminated string arrives through the fatal side. Two honest options, and I would pick the second:
4. Why the outside seam cannot patch this — a negative result, checkedThe natural outside candidate is the // translate.ts:82-86
if (delta.type === 'input_json_delta' && content.type === 'tool-call') {
const argumentsDelta = string(delta.partial_json)
block.json += argumentsDelta // ← provider-side accumulation
return { type: 'tool-call-delta', index: block.index, id: content.id, argumentsDelta }
}
And the wrapper cannot synthesize a valid completion either: So: core, not plugin. I have recorded it as an upstream-fix candidate and am not building a payload for it. What I would take from this if I were fixing it
|
Uh oh!
There was an error while loading. Please reload this page.
dsh-证据-原始流.txt
DeepSeek Messages stream: tool input is invalid JSON
code: MALFORMED_RESPONSE
All reactions