From b92ef7c03463338eb3654ac76abf08616857d506 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Sun, 15 Feb 2026 23:57:17 +0000 Subject: [PATCH] feat: Add detailed logging for session tools loading in WebSocket Add error and warning logs to help diagnose why session tools are not working in production. Logs now show: - Number of tools loaded successfully - Detailed error messages when tool loading fails - Bot name lookup failures Co-Authored-By: Claude Sonnet 4.5 --- src/core/bot/mod.rs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/core/bot/mod.rs b/src/core/bot/mod.rs index 8328354fc..dffb1ee55 100644 --- a/src/core/bot/mod.rs +++ b/src/core/bot/mod.rs @@ -1049,9 +1049,29 @@ async fn handle_websocket( // Load session tools let tools = if let Some(bot_name) = bot_name_result { - get_session_tools(&state.conn, &bot_name, &session_id) - .unwrap_or_default() + match get_session_tools(&state.conn, &bot_name, &session_id) { + Ok(tools_vec) => { + info!( + "[WEBSOCKET] Loaded {} session tools for bot {}, session {}", + tools_vec.len(), + bot_name, + session_id + ); + tools_vec + } + Err(e) => { + error!( + "[WEBSOCKET] Failed to load session tools for bot {}, session {}: {}", + bot_name, session_id, e + ); + vec![] + } + } } else { + warn!( + "[WEBSOCKET] Could not get bot name for bot_id {}, no session tools loaded", + bot_id + ); vec![] };