Repository navigation
[Bug] Benign Chinese ops prompt → stream ends with stop reason "refusal" → client reports MALFORMED_RESPONSE (deepseek-flash) #11337
SummaryA benign operational instruction (24 Chinese characters, no sensitive content) caused the Messages-style stream to terminate with an upstream The model had already emitted a reasoning block (it clearly understood the task), then the stream closed with Environment
Input (verbatim)Translation: "Today's market daily-candle data has finished updating; you can run the scheduled tasks ahead of time." Context: this is a message from a human operator to an assistant working inside an internal automation setup. It contains no request for harmful content — it is purely about triggering previously agreed, already-scheduled work now that its data dependency is satisfied. What the client receivedAn {"type":"chunk","chunk":{"type":"block-start","index":0,"blockType":"reasoning"}}
{"type":"chunk","chunk":{"type":"reasoning-chunks","index":0,...}}
{"type":"chunk","chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"New user message: \"今天行情日K数据已经更新完成了,可以将预约的任务提前执行\" ... (the model correctly restates the task and plans which pending item to run) — omitted here for brevity"}}}
{"type":"chunk","chunk":{"type":"finish","reason":{"kind":"error","failure":{"message":"DeepSeek Messages stream: unsupported stop reason refusal","code":"MALFORMED_RESPONSE"}}}}So the reasoning was produced normally; the stream then reported a Why I believe this is a false positive
Questions for maintainers
Notes
中文摘要:一条完全无害的运营指令(「今天行情日K数据已经更新完成了,可以将预约的任务提前执行」)被上游以 |
Replies: 2 comments
|
I checked the current Harness code at So If it happens again, a redacted |
|
Hi! One distinction worth making here is between the provider's decision to refuse a request and the client's handling of the response. Even if the provider incorrectly refused a harmless instruction, a recognized I would suggest:
The potential false-positive classification and the client-side error mapping are two separate problems. The client can improve its reporting even before the provider's refusal behavior is investigated. Since this happened only once, comparing a second request with the same harmless prompt would also help determine whether the refusal is reproducible. |
I checked the current Harness code at
f3803c9. In the DeepSeek Messages adapter,message_deltapassesstop_reasontostopReason(). That function currently handlesend_turn,stop_sequence,tool_useandmax_tokens; every other value goes throughmalformed(). I also ran that function in isolation:refusalproduces the error you saw.So
MALFORMED_RESPONSEhere is the Harness client's classification of an unsupported value; by itself it doesn't establish why the provider sent it. For comparison, Anthropic documentsrefusalas a Messages stop reason, but that documentation is for Claude and doesn't establish DeepSeek's contract or the cause of this particular refusal.If it happens again, a red…