Skip to main content

finalize_rejected_runner_if_distinct

Function finalize_rejected_runner_if_distinct 

Source
pub async fn finalize_rejected_runner_if_distinct(
    runners: &Arc<RwLock<HashMap<String, AgentRunner>>>,
    session_id: &str,
    existing_owner_run_id: &str,
    attempted_run_id: &str,
    result: &Result<(), AgentError>,
) -> bool
Expand description

Finalize a rejected caller only when it owns a distinct runner slot.

A duplicate task can race with the live task while both observe the same registry run id. Rejecting that duplicate must not terminalize the slot that still belongs to the registered owner.