Skip to main content

lock_unanswered_for_execution

Function lock_unanswered_for_execution 

Source
pub async fn lock_unanswered_for_execution(
    conn: &mut PgConnection,
    tool_call_id: Uuid,
) -> ModelResult<()>
Expand description

Locks the call row for the duration of the surrounding transaction and refuses to hand it over for execution if it already has an output.

This is the exactly-once guard for a confirmable action: two concurrent confirms of the same call serialize on FOR UPDATE, and the loser sees the output that the winner just inserted and errors here instead of running the mutation a second time. Errors with ModelErrorType::InvalidRequest when an output already exists, and with ModelErrorType::RecordNotFound when the call itself does not.