5d0127bfb433c7da7f00fa903350cb8735c4c05d
When a tool call crashes (e.g. httpx timeout in kb_search), the LangGraph
checkpoint retains an AIMessage with tool_calls but no corresponding
ToolMessage. Subsequent requests to the same conversation_id fail with:
ValueError: Found AIMessages with tool_calls that do not have a
corresponding ToolMessage
Now the except block in _stream_response detects this specific ValueError
by checking for "tool_calls" and "ToolMessage" in the error string, then
calls checkpointer.adelete_thread() to purge the corrupted thread state.
The frontend receives {"type":"error","content":"对话状态异常,已自动重置..."}
followed by {"type":"done"}, so the user can simply resend their message.
API confirmed: AsyncPostgresSaver.adelete_thread(thread_id) deletes from
checkpoints, checkpoint_blobs, and checkpoint_writes tables for the thread.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Description
No description provided
14 MiB
Languages
TypeScript
89.2%
CSS
4.3%
Makefile
2.9%
JavaScript
2.5%
Dockerfile
0.5%
Other
0.6%