From 88b65cc82a5f7930dcb45592459cc1245bebf94a Mon Sep 17 00:00:00 2001 From: brooklyn! Date: Sat, 25 Apr 2026 15:57:18 -0500 Subject: [PATCH] Update run_agent.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- run_agent.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/run_agent.py b/run_agent.py index a28d04f2..e9e10052 100644 --- a/run_agent.py +++ b/run_agent.py @@ -7754,10 +7754,11 @@ class AIAgent: # 2. DeepSeek / Kimi thinking mode: tool-call turns with neither # reasoning_content nor reasoning are "poisoned history" — a prior - # provider (MiniMax, etc.) left them empty. DeepSeek rejects HTTP 400 + # provider (MiniMax, etc.) left them empty. DeepSeek returns HTTP 400 # if reasoning_content is absent on replay. Inject "" to satisfy the # provider's requirement without forwarding cross-provider content. - has_reasoning = isinstance(source_msg.get("reasoning"), str) and source_msg.get("reasoning") + normalized_reasoning = source_msg.get("reasoning") + has_reasoning = isinstance(normalized_reasoning, str) and bool(normalized_reasoning.strip()) needs_empty_reasoning = ( not has_reasoning and source_msg.get("tool_calls")