Repository navigation
Description
Client or integration
Other — WorkBuddy configured as an OpenAI Compatible / Chat Completions client.
Provider or upstream service
OpenCode Go (opencode-go, openai-chat adapter; https://opencode.ai/zen/go/v1).
OpenCodex version
2.86.0
Endpoint or capability
/v1/chat/completions — DeepSeek V4.1 Flash thinking-mode tool-call continuation / reasoning_content replay.
Current behaviour
A fresh WorkBuddy conversation using opencode-go/deepseek-v4.1-flash initially works, but fails with HTTP 400 during tool-call continuation. A resumed conversation fails as well. The upstream rejects the request because reasoning_content in thinking mode was not passed back.
This occurs with requestedEffort: high and with no explicit reasoning effort. Adding deepseek-v4.1-flash to preserveReasoningContentModels did not resolve it.
Control: Switching only the model to opencode-go/deepseek-v4-flash allows tool calls to work in the same WorkBuddy → OpenCodex → OpenCode Go setup.
The error-summary trace shows native Chat → Chat routing (same-wire-native), not Responses-to-Chat translation. The available summary does not include the serialized messages, so the exact layer that drops or rejects reasoning history is not yet confirmed.
Expected behaviour
Tool-call continuation for deepseek-v4.1-flash should preserve or correctly relay the thinking metadata required by the upstream API, or clearly report an unsupported combination instead of failing after tool execution. Behaviour should be consistent with the working deepseek-v4-flash route where compatible.
Minimal redacted request or reproduction
1. OpenCodex 2.86.0, provider opencode-go:
adapter: openai-chat
baseUrl: https://opencode.ai/zen/go/v1
preserveReasoningContentModels includes:
deepseek-v4-flash, deepseek-v4.1-flash
2. Connect WorkBuddy through its OpenAI Compatible (Chat Completions) integration.
3. Start a NEW conversation with model opencode-go/deepseek-v4.1-flash.
4. Ask it to perform a task requiring a tool call and continue after the tool result.
5. Observe HTTP 400 requiring reasoning_content to be passed back.
6. Repeat with high reasoning effort and with no explicit reasoning effort: both fail.
7. Start another new conversation, changing only model to
opencode-go/deepseek-v4-flash: tool calling succeeds.
Request summary on failing attempts:
inboundProtocol: chat
adapter: openai-chat
protocolTrace.inbound: chat
protocolTrace.upstream: chat
protocolTrace.mode: native
protocolTrace.reasonCodes: [same-wire-native]
protocolTrace.featureEffects: request.tools = passthrough
failureCause: payload-rejected
resendPermission: refused-futile
Note: A raw HTTP request body is not available yet; this is a
client-level reproduction plus a redacted OpenCodex request summary.
Actual response or error
HTTP 400 invalid_request_error
Provider error 400: Upstream request failed:
[invalid_request_error] The `reasoning_content` in the thinking mode
must be passed back to the API.
failureStage: headers-only
failureCause: payload-rejected
attempts: 1
Upstream documentation
OpenCode Go service: https://opencode.ai/zen/go
No public OpenCode Go-specific specification for the required deepseek-v4.1-flash thinking/tool-call replay payload has been verified. The error itself explicitly requires returning reasoning_content in thinking-mode history.
Suggested mapping or implementation notes
Please inspect the native openai-chat tool-call continuation path and compare the inbound/outbound message structure for deepseek-v4.1-flash versus the working deepseek-v4-flash. In particular, check whether assistant tool-call history retains a nonempty reasoning_content when the tool result is submitted. This may be a client-history issue, proxy replay/serialization issue, or an upstream model-specific contract; current evidence does not establish which.
Additional context and attachments
Related historical issues: #950, #1193, #5421, #4632. Unlike the subagent/Responses cases, this reproduction is WorkBuddy over native Chat → Chat, and it also reproduces in a fresh conversation.
Environment: macOS (exact OS release not recorded).
Checks
- I searched existing provider and compatibility issues.
- The request and response were redacted.
- The expected behaviour is based on an upstream specification or a concrete client requirement.
Activity
ls-open commentedon Oct 15, 2026
同在 macOS 环境下,我也遇到过调用 DeepSeek 等思考模型时报错
[invalid_request_error] The reasoning_content in the thinking mode must be passed back to the API的问题。这个问题的根因在于:客户端在执行完工具调用(tool_use)并将工具输出(tool_result)组装进下一轮请求历史时,把前一轮模型生成的
thinking/reasoning_content内容块给丢弃或截断了。而 DeepSeek 协议对于启用了思考模式的模型有严格状态机约束:只要历史里出现过 tool_calls,前面的 reasoning 内容必须原样回传,否则直接触发 400 校验失败。我们在本地网关层实现了一套 Thinking 自动索引与回填机制(Thinking Restoration):
👉 ls-open/claude-tuner
做法是:网关在流式接收时自动按消息唯一 ID 对模型的 thinking 内容建立本地内存索引;后续如果检测到客户端发出的请求历史中缺少对应的 thinking 块,网关会在内存请求副本中自动将原件补齐回填,再发向上游。这样既避免了 400 报错,同时也能保证请求字节恒定不破坏 DeepSeek 的 prompt cache 前缀。
项目是纯 Python 零依赖的,目前针对 macOS 做了深度闭环适配。如果你正在寻找本地层的容错修整方案,欢迎参考或试用交流!
fix(chat): restore DeepSeek reasoning on native tool continuations (#…
Ingwannu commentedon Oct 16, 2026
Fixed on
devby #7140, commit9d4c82a17ef58be81571ac49c0ee3bf9da635e02.Native Chat-to-Chat now captures and restores omitted DeepSeek reasoning for tool continuations, scoped to the conversation, destination, model and physical credential. Supplied history remains unchanged.
I checked that the merge commit is an ancestor of current inspected
dev@4ae49360b7and that its implementation is present. Regression commands and results are recorded in #7140; I did not rerun those tests in this triage pass. Live WorkBuddy/OpenCode Go confirmation remains unverified; the merged PR records offline HTTP wire regressions.Closing as completed on the integration branch. This is not a claim that the fix has reached an npm/desktop release; please use a build containing the commit when checking the result.