DeepSeek/Kimi reasoning field promotion bug fixes

NousResearch/hermes-agent · cluster 15812

Data as of

Nothing open on GitHub. Fix merged in #15478. Check it covers your case.

The short answer

0open issues
0open PRs
5items grouped
Known?
Yes. 5 related items grouped here, 1 issue already closed.
Fix event
A fix was merged to main in PR #15478. Check it covers your case. No release data is tracked.
Tracker
The maintainers' tracker marks this resolved, deciding PR #16097. That is separate from the fix event.
Still open
Nothing open on GitHub.

Multiple fixes and related regression reports targeting correct placement and promotion of the reasoning_content field in DeepSeek/Kimi assistant messages, particularly during tool-call turns. The cluster centers on a specific regression introduced by an earlier change and subsequent attempts to restore correct behavior.

Open issues0

No open issues.

Open PRs0

No open pull requests.

Fixes on record

Merged to main. A stamp counts the issues a fix is linked to.

  • #15478 fix: DeepSeek/Kimi thinking mode requires reasoning_content on ALL assistant messages

    merged to main

    files: run_agent.py, tests/run_agent/test_deepseek_reasoning_content_echo.py

    Show the diff
    • run_agent.py
      @@ -7785,7 +7785,17 @@ def _copy_reasoning_content_for_api(self, source_msg: dict, api_msg: dict) -> No
                   api_msg["reasoning_content"] = normalized_reasoning
                   return
       
      -        # 4. reasoning_content was present but not a string (e.g. None after
      +        # 4. DeepSeek / Kimi thinking mode: all assistant messages need
      +        # reasoning_content. Inject "" to satisfy the provider's requirement
      +        # when no explicit reasoning content is present.
      +        if (
      +            self._needs_kimi_tool_reasoning()
      +            or self._needs_deepseek_tool_reasoning()
      +        ):
      +            api_msg["reasoning_content"] = ""
      +            return
      +
      +        # 5. reasoning_content was present but not a string (e.g. None after
               # context compaction).  Don't pass null to the API.
               api_msg.pop("reasoning_content", None)
       
    • tests/run_agent/test_deepseek_reasoning_content_echo.py
      @@ -88,13 +88,13 @@ def test_deepseek_tool_call_poisoned_history_gets_empty_string(self) -> None:
               agent._copy_reasoning_content_for_api(source, api_msg)
               assert api_msg.get("reasoning_content") == ""
       
      -    def test_deepseek_assistant_no_tool_call_left_alone(self) -> None:
      -        """Plain assistant turns without tool_calls don't get padded."""
      +    def test_deepseek_assistant_no_tool_call_gets_padded(self) -> None:
      +        """DeepSeek thinking mode pads ALL assistant turns, even without tool_calls."""
               agent = _make_agent(provider="deepseek", model="deepseek-v4-flash")
               source = {"role": "assistant", "content": "hello"}
               api_msg: dict = {}
               agent._copy_reasoning_content_for_api(source, api_msg)
      -        assert "reasoning_content" not in api_msg
      +        assert api_msg.get("reasoning_content") == ""
       
           def test_deepseek_explicit_reasoning_content_preserved(self) -> None:
               """When reasoning_content is already set, it's copied verbatim."""
  • #16097 fix(run_agent): restore reasoning field promotion on DeepSeek/Kimi tool-call turns (salvage #15883)

    merged to main

    files: run_agent.py, scripts/release.py

2 PRs closed without merging

From the close comments: done elsewhere 1 · merged via another change 1

  • #15830 fix(reasoning): promote reasoning field before empty-pad for DeepSeek/Kimi (#15812) · done elsewhere → 93a2d6b, d58b305, ad0ac89, 5ae6081, 9daa062, 63bf7a2, #16500
  • #15883 fix(run_agent): prevent reasoning_content regression in DeepSeek/Kimi tool-call replay (#15812) · merged via another change → 63bf7a2, #16097, #15478
Closed issues · 1
  • Closed#15812regression: #15749 breaks reasoning field promotion for DeepSeek/Kimi tool-call messages
How this cluster was grouped
  • Link evidence (structural links throughout): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
  • Pairwise link density 0.40: the share of item pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. 1.00 means every pair is linked.

Pick up a Lab task

Check whether a fix covers the open issues here, with your own agent. Bring back evidence for maintainers.

Open the Lab

At a glance

Merged PRs
#15478, #16097
Closed issues
1
Attempts
2 PRs closed without merging
Fix link checked
26 Apr 2026

For your agent

The same facts, typed.