fix(run_agent): restore reasoning field promotion on DeepSeek/Kimi tool-call turns (salvage #15883)#16097
Merged
Merged
Conversation
… 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.
4 tasks
6 tasks
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.
Salvage of #15883 onto current main. Fixes the regression reported in #15812.
Summary
Promotes the internal
reasoningfield toreasoning_contentBEFORE 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_apiso the DeepSeek/Kimi tool-call empty-string guard (step 2) returned before thereasoning→reasoning_contentpromotion (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— promotereasoningfirst, 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
test_deepseek_reasoning_field_promoted'' == 'thought trace')tests/run_agent/test_deepseek_reasoning_content_echo.py(full file)Cherry-picked from @yes999zc's commit (authored as FocusFlow Dev). Original PR: #15883.
Closes #15812