fix: DeepSeek/Kimi thinking mode requires reasoning_content on ALL assistant messages#15478
Merged
OutThisLife merged 1 commit intoApr 26, 2026
Conversation
Collaborator
This was referenced Apr 25, 2026
Closed
…sistant messages
Previously _copy_reasoning_content_for_api only padded reasoning_content
when the assistant message had tool_calls. DeepSeek V4 thinking mode
requires the field on every assistant turn, including plain text replies
without tool_calls.
- Remove the 'source_msg.get("tool_calls") and' guard
- Update test: plain assistant turns now get padded for DeepSeek/Kimi
Fixes #15213
e48aab0 to
ad0ac89
Compare
4 tasks
teknium1
pushed a commit
that referenced
this pull request
Apr 26, 2026
… tool-call replay PR #15478 fixed missing reasoning_content for DeepSeek API but introduced a regression: tool-call messages with genuine 'reasoning' field were overwritten by empty-string fallback before promotion. Re-order _copy_reasoning_content_for_api steps: 1. Preserve explicit reasoning_content 2. Promote 'reasoning' field (MOVED UP) 3. DeepSeek/Kimi tool-call empty-string fallback (MOVED DOWN) 4. Non-thinking provider cleanup Fixes #15812, relates #15749, #15478.
6 tasks
2 tasks
ulasbilgen
pushed a commit
to ulasbilgen/hermes-adhd-agent
that referenced
this pull request
May 1, 2026
…oning-all-assistant-messages fix: DeepSeek/Kimi thinking mode requires reasoning_content on ALL assistant messages
ulasbilgen
pushed a commit
to ulasbilgen/hermes-adhd-agent
that referenced
this pull request
May 1, 2026
… tool-call replay PR NousResearch#15478 fixed missing reasoning_content for DeepSeek API but introduced a regression: tool-call messages with genuine 'reasoning' field were overwritten by empty-string fallback before promotion. Re-order _copy_reasoning_content_for_api steps: 1. Preserve explicit reasoning_content 2. Promote 'reasoning' field (MOVED UP) 3. DeepSeek/Kimi tool-call empty-string fallback (MOVED DOWN) 4. Non-thinking provider cleanup Fixes NousResearch#15812, relates NousResearch#15749, NousResearch#15478.
donald131
pushed a commit
to donald131/hermes-agent
that referenced
this pull request
May 2, 2026
… tool-call replay PR NousResearch#15478 fixed missing reasoning_content for DeepSeek API but introduced a regression: tool-call messages with genuine 'reasoning' field were overwritten by empty-string fallback before promotion. Re-order _copy_reasoning_content_for_api steps: 1. Preserve explicit reasoning_content 2. Promote 'reasoning' field (MOVED UP) 3. DeepSeek/Kimi tool-call empty-string fallback (MOVED DOWN) 4. Non-thinking provider cleanup Fixes NousResearch#15812, relates NousResearch#15749, NousResearch#15478.
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…oning-all-assistant-messages fix: DeepSeek/Kimi thinking mode requires reasoning_content on ALL assistant messages
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
… tool-call replay PR NousResearch#15478 fixed missing reasoning_content for DeepSeek API but introduced a regression: tool-call messages with genuine 'reasoning' field were overwritten by empty-string fallback before promotion. Re-order _copy_reasoning_content_for_api steps: 1. Preserve explicit reasoning_content 2. Promote 'reasoning' field (MOVED UP) 3. DeepSeek/Kimi tool-call empty-string fallback (MOVED DOWN) 4. Non-thinking provider cleanup Fixes NousResearch#15812, relates NousResearch#15749, NousResearch#15478.
dannyJ848
pushed a commit
to dannyJ848/hermes-agent
that referenced
this pull request
May 17, 2026
…oning-all-assistant-messages fix: DeepSeek/Kimi thinking mode requires reasoning_content on ALL assistant messages
dannyJ848
pushed a commit
to dannyJ848/hermes-agent
that referenced
this pull request
May 17, 2026
… tool-call replay PR NousResearch#15478 fixed missing reasoning_content for DeepSeek API but introduced a regression: tool-call messages with genuine 'reasoning' field were overwritten by empty-string fallback before promotion. Re-order _copy_reasoning_content_for_api steps: 1. Preserve explicit reasoning_content 2. Promote 'reasoning' field (MOVED UP) 3. DeepSeek/Kimi tool-call empty-string fallback (MOVED DOWN) 4. Non-thinking provider cleanup Fixes NousResearch#15812, relates NousResearch#15749, NousResearch#15478.
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…oning-all-assistant-messages fix: DeepSeek/Kimi thinking mode requires reasoning_content on ALL assistant messages
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
… tool-call replay PR NousResearch#15478 fixed missing reasoning_content for DeepSeek API but introduced a regression: tool-call messages with genuine 'reasoning' field were overwritten by empty-string fallback before promotion. Re-order _copy_reasoning_content_for_api steps: 1. Preserve explicit reasoning_content 2. Promote 'reasoning' field (MOVED UP) 3. DeepSeek/Kimi tool-call empty-string fallback (MOVED DOWN) 4. Non-thinking provider cleanup Fixes NousResearch#15812, relates NousResearch#15749, NousResearch#15478.
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
…oning-all-assistant-messages fix: DeepSeek/Kimi thinking mode requires reasoning_content on ALL assistant messages
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
… tool-call replay PR NousResearch#15478 fixed missing reasoning_content for DeepSeek API but introduced a regression: tool-call messages with genuine 'reasoning' field were overwritten by empty-string fallback before promotion. Re-order _copy_reasoning_content_for_api steps: 1. Preserve explicit reasoning_content 2. Promote 'reasoning' field (MOVED UP) 3. DeepSeek/Kimi tool-call empty-string fallback (MOVED DOWN) 4. Non-thinking provider cleanup Fixes NousResearch#15812, relates NousResearch#15749, NousResearch#15478.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DeepSeek V4 thinking mode requires
reasoning_contenton every assistant message, not just tool-call turns. The existing fix (#15250) only covered the tool-call path.When an assistant message is a plain text reply (no
tool_calls) andreasoningis empty,_copy_reasoning_content_for_apiskips padding entirely, causing DeepSeek to reject the next request with:Fix
Remove the
source_msg.get("tool_calls") andguard in_copy_reasoning_content_for_apiso all DeepSeek/Kimi assistant messages getreasoning_content=""when needed.Changes
run_agent.py: broaden condition fromtool_calls + providerto justprovidertest_deepseek_reasoning_content_echo.py: update test to expect padding on plain assistant turnsVerification
pytest tests/run_agent/test_deepseek_reasoning_content_echo.py -v— 21/21 passed.Fixes #15213