BYOK DeepSeek thinking mode: multi-turn 400 'reasoning_content must be passed back'
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript
调研方向
从 dist/cli.mjs 中的 toAiSdkMessages()、assistantParts() 和 reasoningProviderOptions() 开始;将这条路径与已经输出 reasoning 文本的 toWireMessages() 进行比较。重现两轮 BYOK DeepSeek thinking 对话,然后验证第二个请求已被接受,并且使用 continue 重试时不再发送无效的历史记录。
由索引模型根据 Issue 内容生成。
描述
Summary
Every turn after the first fails with HTTP 400 "The reasoning_content in the thinking mode must be passed back to the API." when using a BYOK DeepSeek thinking model. The session is permanently stuck: "Type continue to try again" resends the identical rejected history and fails the same way.
Expected Behavior
Multi-turn BYOK conversations in thinking mode should work. Prior assistant reasoning should be round-tripped in whatever form the provider requires, or omitted from the outgoing history entirely - cmd should never send a half-formed reasoning part. Either way, the session must not become unrecoverable after a provider rejection.
Actual Behavior
The second and every subsequent turn is rejected with a hard 400:
Error: 400 Invalid_request_error
The reasoning_content in the thinking mode must be passed back to the API.
Trace ID: 84656912281782c2007c9b58fed565ad
"Type continue to try again" does not recover the session - retrying resends the same history and fails identically.
Steps to reproduce the issue
- Configure a BYOK provider that relays a DeepSeek thinking model in ~/.commandcode/providers.json.
- Select that model with thinking enabled.
- Send a first message - it succeeds, and the assistant turn is stored with a thinking block whose signature is empty.
- Send a second message - the outgoing history contains that assistant turn, and the provider rejects the whole request with the 400 above.
Command Code Version
1.56.1
Operating System
Windows
Terminal/IDE
Orca
Shell
cmd.exe
Session file (optional)
No response
Fix prompt (optional)
Two small changes in dist/cli.mjs, both in the AI SDK message path that BYOK uses:
-
assistantParts(): the guard
(r.signature || r.redactedData) &&drops every reasoning part whose signature is empty, which is exactly what cmd persists for BYOK thinking. Do not gate reasoning on signature for providers that have no signature concept - emit the reasoning text with no providerOptions instead. -
reasoningProviderOptions(): only maps anthropic and openai.reasoningEncryptedContent. Add a DeepSeek/chat-completions mapping so the previous reasoning text is echoed back as reasoning_content on prior assistant messages.
Verify with a two-turn conversation against a DeepSeek thinking model through a BYOK provider, confirming the second request is accepted. Also consider making "continue" usable after this error instead of resending the identical rejected history.
Additional context
Environment:
- cmd 1.56.1, Windows (win32 x64), Node v24.16.0, terminal Orca, shell cmd.exe
- BYOK provider in ~/.commandcode/providers.json: fixcode with baseURL https://api.fixcode.shop/v1, models deepseek-flash and deepseek-v4-flash-vision-exp
- Model in use: fixcode/deepseek-flash
Root cause (read from dist/cli.mjs):
The BYOK path builds provider messages via toAiSdkMessages() -> assistantParts(). The reasoning part is guarded like this:
(r.signature || r.redactedData) && n.push({ type: "reasoning", text: ..., providerOptions: reasoningProviderOptions(r) })
cmd persists BYOK thinking blocks as {"type":"thinking","thinking":"...","signature":""}, so r.signature is "" (falsy) and the reasoning part is never emitted. Prior-turn reasoning never reaches the wire at all.
Even when it is emitted, reasoningProviderOptions() only maps anthropic and openai.reasoningEncryptedContent. DeepSeek-style providers require the raw reasoning text echoed back as reasoning_content on prior assistant messages. "reasoning_content" appears 0 times in the entire dist/cli.mjs bundle.
Note the other serializer, toWireMessages(), pushes {type:"reasoning", text:t.thinking} unconditionally, so the two paths disagree - and only the AI SDK one runs for BYOK.
- 主要语言
- 没有语言数据
- 星标
- 4k
- 派生
- 350
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CommandCodeAI/command-code 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
CommandCodeAI/command-code#855 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
CommandCodeAI/command-code#841 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
CommandCodeAI/command-code#655 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
CommandCodeAI/command-code#608 ·
-
难度 3/5 1-2 天 新手友好度 70/100
CommandCodeAI/command-code#893 ·
查看 CommandCodeAI/command-code 的全部 Issue
相似的 Issue
-
[FEATURE]: Bump gitlab-ai-provider to 6.15.1 on v2 (Fable 5.1, GPT-6 Astra, workflow reconnect fix) 未关闭
难度 1/5 1 小时以内 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 82/100
registrystack/registry-stack#1239 ·
-
bug priority:normal ready-for-dev
难度 2/5 1-3 小时 新手友好度 88/100
OpenHands/extensions#626 · 1 条评论 ·
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
avniproject/avni-client#2135 ·
-
难度 2/5 1-3 小时 新手友好度 88/100