openclaw - 💡(How to fix) Fix fix: preserve reasoning_content for DeepSeek models through proxy providers (opencode-native) [2 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

When using DeepSeek V4 models through a proxy provider like OpenCode Zen (opencode-native endpoint class), the agent gets stuck on tool calls. The root cause is that reasoning_content from the assistant's response is not preserved in follow-up requests after tool execution.

Error Message

The DeepSeek V4 API requires reasoning_content to be echoed back in the assistant message when continuing the conversation after tool calls. If missing, it returns a 500 error.

Root Cause

The DeepSeek V4 API requires reasoning_content to be echoed back in the assistant message when continuing the conversation after tool calls. If missing, it returns a 500 error.

Fix Action

Fixed

RAW_BUFFERClick to expand / collapse

Description

When using DeepSeek V4 models through a proxy provider like OpenCode Zen (opencode-native endpoint class), the agent gets stuck on tool calls. The root cause is that reasoning_content from the assistant's response is not preserved in follow-up requests after tool execution.

Root Cause

The DeepSeek V4 API requires reasoning_content to be echoed back in the assistant message when continuing the conversation after tool calls. If missing, it returns a 500 error.

Code Analysis

In openai-transport-stream.ts, shouldPreserveReasoningContentReplay() checks three conditions:

  1. compat.requiresReasoningContentOnAssistantMessages — set when isDeepSeek or isXiaomi in compat detection
  2. compat.thinkingFormat === "deepseek" — same
  3. Model ID in REASONING_CONTENT_REPLAY_MODEL_IDS set

Problem 1: isDeepSeek checks endpointClass === "deepseek-native" — but when DeepSeek models are accessed through a proxy like OpenCode Zen, the endpoint class is "opencode-native", not "deepseek-native". So conditions 1 and 2 both fail.

Problem 2: The REASONING_CONTENT_REPLAY_MODEL_IDS set lists deepseek-v4-flash but not deepseek-v4-flash-free or big-pickle (also DeepSeek-based models).

Problem 3: In getCompat(), requiresReasoningContentOnAssistantMessages is hardcoded to auto-detected only, not allowing model compat override.

Suggested Fix

  1. Add deepseek-v4-flash-free and big-pickle to REASONING_CONTENT_REPLAY_MODEL_IDS
  2. OR extend isDeepSeek detection to recognize DeepSeek models through proxy endpoints

Steps to Reproduce

  1. Configure OpenCode Zen provider with deepseek-v4-flash-free model
  2. Send a message requiring tool use
  3. Agent gets stuck after executing tools — API returns 500 about missing reasoning_content

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING