test(session): preserve reasoning_content in session history

This commit is contained in:
Xubin Ren 2026-04-04 12:02:42 +00:00 committed by Xubin Ren
parent 519911456a
commit 11c84f21a6

View File

@ -173,6 +173,27 @@ def test_empty_session_history():
assert history == []
def test_get_history_preserves_reasoning_content():
session = Session(key="test:reasoning")
session.messages.append({"role": "user", "content": "hi"})
session.messages.append({
"role": "assistant",
"content": "done",
"reasoning_content": "hidden chain of thought",
})
history = session.get_history(max_messages=500)
assert history == [
{"role": "user", "content": "hi"},
{
"role": "assistant",
"content": "done",
"reasoning_content": "hidden chain of thought",
},
]
# --- Window cuts mid-group: assistant present but some tool results orphaned ---
def test_window_cuts_mid_tool_group():