feat: Add detailed logging for session tools loading in WebSocket
All checks were successful
BotServer CI / build (push) Successful in 10m35s

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 <noreply@anthropic.com>
This commit is contained in:
Rodrigo Rodriguez 2026-02-15 23:57:17 +00:00
parent 0883fe9cce
commit b92ef7c034

View file

@ -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![]
};