Skip to main content

Module repair

Expand description

Answering tool calls that a dead turn left without an output, which the LLM rejects for every later message of the conversation.

Constants§

HANGING_TOOL_CALL_REAP_AFTER_MINUTES 🔒
How long a tool call must have gone unanswered before a request that did not make it may abort it. A live turn writes a call and its output seconds apart, but a slow search or a reasoning round widens that gap, and aborting inside it leaves two outputs for one tool_call_id.

Functions§

answer_stale_unfinished_tool_calls 🔒
Repairs tool calls left behind by turns that are long dead, without touching one that a turn streaming in a concurrent request may still be about to answer. Returns the calls it left unanswered.
answer_unfinished_tool_calls 🔒
Repairs the tool calls that the turn this request is itself running left unanswered, whatever their age. response_ids names the responses that turn’s rounds were given, which is what keeps it off the calls of a turn streaming in another request. Use answer_stale_unfinished_tool_calls from a request that made none of them.
reap_unanswered_tool_calls 🔒
Aborts the conversation’s tool calls that have no output and fall within scope. Returns the calls it left unanswered.