[GH-ISSUE #4638] [Engine] serve: Chat Completions ignores DeepSeek's thinking: {"type": "disabled"} #2106

Open
opened 2026-11-04 01:56:43 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @chestercs on GitHub (Oct 29, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4638

Area

[Engine]

Desktop app, Terminal or source?

Docker: the release engine package, with the server from a v0.2.7.1 checkout.

What happened

On Chat Completions, a DeepSeek request with "thinking": {"type": "disabled"} still thinks. This field is how DeepSeek's own API turns thinking off, next to reasoning_effort. Clients written for DeepSeek send only this field to turn thinking off; OpenClaw's deepseek thinking format does this for /think off.

openai_to_messages() reads reasoning_effort, reasoning.effort and chat_template_kwargs, but not thinking. The Anthropic path (/v1/messages) already reads the same field.

Expected: thinking is off, as with reasoning_effort: "none".

Smallest steps or command that reproduce it

curl -s http://127.0.0.1:<port>/v1/chat/completions -H 'Content-Type: application/json' \
  -d '{"messages":[{"role":"user","content":"What is 17*23? Answer with the number only."}],"thinking":{"type":"disabled"},"max_tokens":1500}'

Without the change, the prompt does not end in the template's empty thinking block; test_thinking_off below shows this. On our live server on 0.2.7, before we patched it, OpenClaw's /think off turns came back with thinking.

The change we run

--- a/serve/frontend.py
+++ b/serve/frontend.py
@@ -615,6 +615,10 @@ def openai_to_messages(req: dict) -> tuple[list[dict], list[dict] | None, dict]:
             kwargs = {"enable_thinking": False}
         elif k == "reasoning_effort" and "enable_thinking" not in kwargs:
             kwargs.update(effort_kwargs(v))
+    # DeepSeek's own API: "thinking": {"type": "disabled"}, beside reasoning_effort.  Clients written for it send only
+    # this to turn the thinking off.
+    if isinstance(req.get("thinking"), dict) and req["thinking"].get("type") == "disabled":
+        kwargs = {"enable_thinking": False}
     return _env_to_user(_late_system_to_user(messages)), tools, kwargs
 
 
--- a/serve/test_dsv41.py
+++ b/serve/test_dsv41.py
@@ -399,7 +399,8 @@ class Api(ApiBase):
 
     def test_thinking_off(self):
         self.start("Hello!")
-        for extra in ({"chat_template_kwargs": {"enable_thinking": False}}, {"reasoning_effort": "none"}):
+        for extra in ({"chat_template_kwargs": {"enable_thinking": False}}, {"reasoning_effort": "none"},
+                      {"thinking": {"type": "disabled"}}, {"thinking": {"type": "disabled"}, "reasoning_effort": "high"}):
             status, r = self.chat(**extra)
             self.assertEqual(status, 200, r)
             self.assertTrue(self.prompt().endswith("<|User|>hi<|Assistant|></think>"), extra)

When thinking is disabled it wins over an effort in the same request, as on the Anthropic path. Requests without the field are unchanged.

Validation on 46c152a1:

  • Passed:
    • python3 -m unittest serve.test_dsv41 serve.test_frontend serve.test_server in a container with the server's requirements: 443 tests, one failure (below).
    • The extended test_thinking_off fails without the change, on {'thinking': {'type': 'disabled'}}, and passes with it.
    • On the real engine (0.1.53 package, DGX Spark, IST-DAS 1.75 bpw), the request above returns 200 with 0 reasoning characters and the answer 391. We have run this change since 2026-10-28.
  • Failed: test_server.VisionTempFiles.test_work_dir_has_no_space_when_temp_has_one, which fails the same way without the change in that container.
  • Not run: the rest of the serve suite, and no engine build (the change is in serve/ only).

Would you like this as a PR? I can open one, or you can take the diff as it is.

Reproduction status

Reproduced locally

Strata version

Strata 0.2.7.1 (46c152a1) · engine 0.1.53

Graphics card, memory and system

DGX Spark (GB10), 128 GB unified · DGX OS, driver 580, CUDA 13.0

Model, size and settings

DeepSeek-V4.1-Flash-1017, ISTA-DASLab GSQ-RCO IQ1_M with the DSpark drafter · 131,072 context

Originally created by @chestercs on GitHub (Oct 29, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4638 ### Area [Engine] ### Desktop app, Terminal or source? Docker: the release engine package, with the server from a v0.2.7.1 checkout. ### What happened On Chat Completions, a DeepSeek request with `"thinking": {"type": "disabled"}` still thinks. This field is how DeepSeek's own API turns thinking off, next to `reasoning_effort`. Clients written for DeepSeek send only this field to turn thinking off; OpenClaw's `deepseek` thinking format does this for `/think off`. `openai_to_messages()` reads `reasoning_effort`, `reasoning.effort` and `chat_template_kwargs`, but not `thinking`. The Anthropic path (`/v1/messages`) already reads the same field. Expected: thinking is off, as with `reasoning_effort: "none"`. ### Smallest steps or command that reproduce it ``` curl -s http://127.0.0.1:<port>/v1/chat/completions -H 'Content-Type: application/json' \ -d '{"messages":[{"role":"user","content":"What is 17*23? Answer with the number only."}],"thinking":{"type":"disabled"},"max_tokens":1500}' ``` Without the change, the prompt does not end in the template's empty thinking block; `test_thinking_off` below shows this. On our live server on 0.2.7, before we patched it, OpenClaw's `/think off` turns came back with thinking. ### The change we run ```diff --- a/serve/frontend.py +++ b/serve/frontend.py @@ -615,6 +615,10 @@ def openai_to_messages(req: dict) -> tuple[list[dict], list[dict] | None, dict]: kwargs = {"enable_thinking": False} elif k == "reasoning_effort" and "enable_thinking" not in kwargs: kwargs.update(effort_kwargs(v)) + # DeepSeek's own API: "thinking": {"type": "disabled"}, beside reasoning_effort. Clients written for it send only + # this to turn the thinking off. + if isinstance(req.get("thinking"), dict) and req["thinking"].get("type") == "disabled": + kwargs = {"enable_thinking": False} return _env_to_user(_late_system_to_user(messages)), tools, kwargs --- a/serve/test_dsv41.py +++ b/serve/test_dsv41.py @@ -399,7 +399,8 @@ class Api(ApiBase): def test_thinking_off(self): self.start("Hello!") - for extra in ({"chat_template_kwargs": {"enable_thinking": False}}, {"reasoning_effort": "none"}): + for extra in ({"chat_template_kwargs": {"enable_thinking": False}}, {"reasoning_effort": "none"}, + {"thinking": {"type": "disabled"}}, {"thinking": {"type": "disabled"}, "reasoning_effort": "high"}): status, r = self.chat(**extra) self.assertEqual(status, 200, r) self.assertTrue(self.prompt().endswith("<|User|>hi<|Assistant|></think>"), extra) ``` When `thinking` is disabled it wins over an effort in the same request, as on the Anthropic path. Requests without the field are unchanged. **Validation on 46c152a1:** - **Passed:** - `python3 -m unittest serve.test_dsv41 serve.test_frontend serve.test_server` in a container with the server's requirements: 443 tests, one failure (below). - The extended `test_thinking_off` fails without the change, on `{'thinking': {'type': 'disabled'}}`, and passes with it. - On the real engine (0.1.53 package, DGX Spark, IST-DAS 1.75 bpw), the request above returns 200 with 0 reasoning characters and the answer 391. We have run this change since 2026-10-28. - **Failed:** `test_server.VisionTempFiles.test_work_dir_has_no_space_when_temp_has_one`, which fails the same way without the change in that container. - **Not run:** the rest of the `serve` suite, and no engine build (the change is in `serve/` only). Would you like this as a PR? I can open one, or you can take the diff as it is. ### Reproduction status Reproduced locally ### Strata version Strata 0.2.7.1 (46c152a1) · engine 0.1.53 ### Graphics card, memory and system DGX Spark (GB10), 128 GB unified · DGX OS, driver 580, CUDA 13.0 ### Model, size and settings DeepSeek-V4.1-Flash-1017, ISTA-DASLab GSQ-RCO IQ1_M with the DSpark drafter · 131,072 context
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2106
No description provided.