Dealing with bot failures
This commit is contained in:
@@ -210,6 +210,17 @@ pub(in crate::chat::transport::matrix::bot) async fn handle_message(
|
||||
|
||||
// Persist to disk so history survives server restarts.
|
||||
save_history(&ctx.services.project_root, &guard);
|
||||
} else {
|
||||
// Clear session_id on error so a poisoned session (e.g. pending
|
||||
// tool call with no response) doesn't cause a crash loop on resume.
|
||||
let mut guard = ctx.history.lock().await;
|
||||
if let Some(conv) = guard.get_mut(&room_id)
|
||||
&& conv.session_id.is_some()
|
||||
{
|
||||
slog!("[matrix-bot] clearing session_id after error to prevent crash loop");
|
||||
conv.session_id = None;
|
||||
save_history(&ctx.services.project_root, &guard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user