Replies: 4 comments
|
I reproduced the serializer shape in both rc.2 ( |
|
Independent source verification of the serializer path in alpha.1 (HEAD cd5ef81) — the reproduction and root cause above both check out, and I can add three concrete details from the current tree. Confirmed at source.
One path is NOT a trigger (narrows the blast radius). The other force-disabled branch ( A second trigger exists: deployment-level disabled thinking. When a connection defaults to Fix structure note. |
|
Implemented and verified on a fork:
The request assembly now resolves the effective thinking mode first. When it is disabled, historical assistant messages are copied without Coverage includes explicit Verification completed:
The executable SDK snapshot runner is currently blocked on this Windows checkout by the existing Upstream pull requests are disabled, so the patch is available at the branch/commit above for review or cherry-pick. |
|
Independent verification of the fork patch against the alpha.1 tree (cd5ef81) — the implementation is complete and matches the required fix structure. Mechanical check. The commit's parent is exactly cd5ef81 (current alpha.1 HEAD), and the full src diff ( Code review — the design is right.
One boundary I checked and found safe. A reasoning-only turn (no text, no tool_calls) strips to On the snapshot runner disclosure. The The patch is ready for cherry-pick. Thanks for implementing the fix so faithfully to the analysis. |
Uh oh!
There was an error while loading. Please reload this page.
Problem
When a conversation has used thinking mode (assistant messages carry
reasoning_content), turning reasoning OFF (reasoning_effort: off→ wirethinking: {type:"disabled"}) and continuing the same session fails with a DeepSeek API 400:A new session with reasoning off works fine; only continuing a session that already has thinking history fails.
Repro
deepseek-v4-flash,reasoning_effort: high) and send a message so the assistant returnsreasoning_content.reasoning_effort: off) in the same session and send a new message.Root cause
packages/llm/llm-deepseek/src/serialize.ts:resolveThinking()returns{ thinking: 'disabled' }forreasoning_effort: 'off', andrequestWithMessages()emitsthinking: {type:"disabled"}— the request is explicitly non-thinking.But
serializeAssistant()(~line 190) unconditionally echoes every historicalreasoningblock asreasoning_content:It has no visibility into the current request's resolved thinking state, and there is no strip path.
Result: a
thinking: disabledrequest still carries historicalreasoning_contentinsidemessages, which DeepSeek rejects ("must be passed back").Expected behavior
When the current request resolves to thinking disabled, historical assistant messages should be serialized without
reasoning_content(stripreasoningblocks), producing a pure non-thinking request. When thinking is enabled, keep the current pass-back behavior.A clean fix: thread the resolved thinking state (or a boolean "pass back reasoning") into
serializeAssistant/serializeMessages/serializeMessagesWithImages, and omitreasoning_contentwhen disabled.Environment
deepseek-v4-flash/deepseek-v4-flash-vision-expAll reactions