Skip to content

fix(run_agent): restore reasoning field promotion on DeepSeek/Kimi tool-call turns (salvage #15883)#16097

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-3c1cf4fd
Apr 26, 2026
Merged

fix(run_agent): restore reasoning field promotion on DeepSeek/Kimi tool-call turns (salvage #15883)#16097
teknium1 merged 2 commits into
mainfrom
hermes/hermes-3c1cf4fd

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvage of #15883 onto current main. Fixes the regression reported in #15812.

Summary

Promotes the internal reasoning field to reasoning_content BEFORE the DeepSeek/Kimi empty-string fallback runs, so same-provider reasoning content is preserved on tool-call replay.

Root cause

PR #15749 reordered _copy_reasoning_content_for_api so the DeepSeek/Kimi tool-call empty-string guard (step 2) returned before the reasoningreasoning_content promotion (step 3). Any assistant tool-call turn with a genuine reasoning trace got its content replaced with "" on replay.

Changes

  • run_agent.py: swap steps 2 and 3 in _copy_reasoning_content_for_api — promote reasoning first, fall back to "" only when no reasoning is present.
  • scripts/release.py: AUTHOR_MAP entry for focusflow.app.help@gmail.com → yes999zc so release-notes CI attributes correctly.

Validation

Before After
test_deepseek_reasoning_field_promoted FAIL ('' == 'thought trace') PASS
tests/run_agent/test_deepseek_reasoning_content_echo.py (full file) 20/21 21/21

Cherry-picked from @yes999zc's commit (authored as FocusFlow Dev). Original PR: #15883.

Closes #15812

FocusFlow Dev and others added 2 commits April 26, 2026 08:24
… 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.
Salvage PR #15883 cherry-picked FocusFlow Dev's commit; release-notes
CI needs the AUTHOR_MAP entry to attribute to the PR author's GitHub
login rather than a placeholder.
@teknium1 teknium1 merged commit c5196f1 into main Apr 26, 2026
11 of 12 checks passed
@teknium1 teknium1 deleted the hermes/hermes-3c1cf4fd branch April 26, 2026 15:25
@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/agent Core agent loop, run_agent.py, prompt builder provider/deepseek DeepSeek API provider/kimi Kimi / Moonshot labels Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P1 High — major feature broken, no workaround provider/deepseek DeepSeek API provider/kimi Kimi / Moonshot type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

regression: #15749 breaks reasoning field promotion for DeepSeek/Kimi tool-call messages

2 participants