pub async fn try_reserve_runner(
runners: &Arc<RwLock<HashMap<String, AgentRunner>>>,
session_id: &str,
event_sender: &Sender<AgentEvent>,
) -> Option<RunnerReservation>Expand description
Try to reserve a runner for the given session.
If a runner with Running status already exists, returns None
(caller should skip execution). The AlreadyRunning case is surfaced
by the caller via ExecuteResponse with the existing runner’s run_id
so the frontend can correlate subsequent SSE events.
Otherwise removes any stale runner and inserts a fresh one, returning
the associated CancellationToken and the new run_id.