From 8f073a15fd782c0d89dc7c89792b7650b1c0155e Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Wed, 18 Mar 2026 14:18:05 -0300 Subject: [PATCH] Fix: Wait for send_task to be ready before executing start.bas so TALK messages work --- src/core/bot/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/bot/mod.rs b/src/core/bot/mod.rs index 7544b6bc..6b05058b 100644 --- a/src/core/bot/mod.rs +++ b/src/core/bot/mod.rs @@ -1374,8 +1374,11 @@ async fn handle_websocket( let state_for_start = state.clone(); let _tx_for_start = tx.clone(); + let mut send_ready_rx = send_ready_rx; tokio::spawn(async move { + let _ = send_ready_rx.recv().await; + let session_result = { let mut sm = state_for_start.session_manager.lock().await; let by_id = sm.get_session_by_id(session_id); @@ -1442,6 +1445,8 @@ async fn handle_websocket( } } + let (send_ready_tx, mut send_ready_rx) = tokio::sync::mpsc::channel::<()>(1); + let mut send_task = tokio::spawn(async move { while let Some(response) = rx.recv().await { if let Ok(json_str) = serde_json::to_string(&response) { @@ -1452,6 +1457,8 @@ async fn handle_websocket( } }); + let _ = send_ready_tx.send(()).await; + let state_clone = state.clone(); let mut recv_task = tokio::spawn(async move { while let Some(Ok(msg)) = receiver.next().await {