The previous implementation only checked the last assistant message for
orphaned tool calls. Mid-conversation crashes or cancellations could
leave orphaned tool_use blocks earlier in the history, causing Anthropic
API errors. Now scans the full history and inserts synthetic cancelled
results for any unmatched tool calls.
Reported-by: hamadayouta