Skip to main content

patch_dangling_tool_calls

Function patch_dangling_tool_calls 

Source
pub fn patch_dangling_tool_calls(messages: &[Message]) -> Vec<Message>
Expand description

Patch dangling tool calls by adding synthetic “cancelled” results.

This ensures every tool call has a corresponding tool result, preventing LLM API errors (e.g., OpenAI requires every tool_call to have a result).

This is the simple, store-free patcher used by out-of-band completions (see crate::command_host). The main reason path uses the durable-store-aware repair_dangling_tool_calls in crate::atoms::reason instead (EVE-533), which can replay settled results rather than synthesizing cancellations.