fix(buzz-agent): replay reasoning_content for DeepSeek thinking mode - #5487
Open
olympusbuildz wants to merge 1 commit into
Open
fix(buzz-agent): replay reasoning_content for DeepSeek thinking mode#5487olympusbuildz wants to merge 1 commit into
olympusbuildz wants to merge 1 commit into
Conversation
olympusbuildz
marked this pull request as ready for review
August 11, 2026 13:14
olympusbuildz
force-pushed
the
fix/buzz-agent-replay-reasoning-content-5399
branch
from
August 11, 2026 13:14
0b8db76 to
6e5938a
Compare
olympusbuildz
force-pushed
the
fix/buzz-agent-replay-reasoning-content-5399
branch
6 times, most recently
from
August 21, 2026 16:13
b984126 to
8a5e00b
Compare
DeepSeek thinking mode returns 400 on any continuation that carries tools when prior assistant turns omit reasoning_content. parse_openai already extracted the field into LlmResponse.reasoning (and ACP thought chunks emitted it), but HistoryItem::Assistant only kept OpenRouter-style reasoning_details — the plain string was dropped before openai_body ran. Persist reasoning on Assistant history and echo it as reasoning_content whenever non-empty. Harmless on plain multi-turn (API ignores it); required for tool loops per DeepSeek docs. Fixes block#5399 Related (stale / multi-concern, not stacked): block#4773 Co-authored-by: Olympusbuildz <Olympus.roots@outlook.com> Signed-off-by: Olympusbuildz <Olympus.roots@outlook.com>
olympusbuildz
force-pushed
the
fix/buzz-agent-replay-reasoning-content-5399
branch
from
August 22, 2026 16:09
8a5e00b to
aa20c20
Compare
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 seats on
buzz-agentwith thinking mode fail on every continuation:Reporter saw 79 hard failures across deepseek-v4-flash/pro in two days (#5399). Iterative tool-using roles break; retries burn tokens for nothing.
Root cause
mainparse_openaicorrectly readsmessage.reasoning_content→LlmResponse.reasoningHistoryItem::Assistantonly stored OpenRouterreasoning_details— plainreasoningdroppedopenai_bodynever wrotereasoning_contentbackDeepSeek docs (thinking mode): for requests that carry
tools, prior assistantreasoning_contentmust be fully passed back or the API 400s.Fix
reasoning: StringonHistoryItem::Assistant(keepreasoning_details).response.reasoningat every assistant history push.openai_body, emitreasoning_contentwhen non-empty.reasoning.len()in estimated bytes.Single concern — no image_url gating, no provider feature work.
Why not #4773
block/buzz#4773 targets the same class but is stale vs current
HistoryItem(reasoning_detailsera), bundlessupports_image_url, emits only when that message has tool_calls, and has no unit tests. This PR is main-current, #5399-only, tested.Closest PR search: #4773 (related), #3403 / #4332 (different). none found that closes #5399 on current main with tests.
Test plan
openai_body_omits_reasoning_content_when_emptyparse_openai_captures_reasoning_contentopenai_body_replays_reasoning_content_on_plain_assistant_when_presentopenai_body_replays_reasoning_content_on_tool_call_assistantbuzz-agentlib suite 484 passed @ head49fc467(rebased on currentmain)just cinot run for this change (package lib gate only)Risk / blast radius
buzz-agenthistory + OpenAI-compat request body onlyFixes #5399
Retested after rebase onto current main @
49fc46796.Acceptance retest (2026-08-18)
Rebased onto current
main. Mini proof @7dd78e177: cargo test -p buzz-agent --lib reasoning_content — 4/4.