Merge PR #748: avoid sending empty content entries in assistant messages

This commit is contained in:
Re-bin 2026-02-17 08:59:49 +00:00
commit 79d15e6023

View File

@ -225,12 +225,16 @@ To recall past events, grep {workspace_path}/memory/HISTORY.md"""
Returns:
Updated message list.
"""
msg: dict[str, Any] = {"role": "assistant", "content": content or ""}
msg: dict[str, Any] = {"role": "assistant"}
# Omit empty content — some backends reject empty text blocks
if content:
msg["content"] = content
if tool_calls:
msg["tool_calls"] = tool_calls
# Thinking models reject history without this
# Include reasoning content when provided (required by some thinking models)
if reasoning_content:
msg["reasoning_content"] = reasoning_content