diff --git a/src/agent/agent_loop.rs b/src/agent/agent_loop.rs index f9745e58..6a4a7a26 100644 --- a/src/agent/agent_loop.rs +++ b/src/agent/agent_loop.rs @@ -1163,9 +1163,7 @@ impl Agent { "Blocked approval for thread with no pending approval" ); drop(sess); - return Ok(Some( - "Error: no pending approval on this thread".into(), - )); + return Ok(Some("Error: no pending approval on this thread".into())); } let authorized = crate::agent::session::is_approval_authorized( diff --git a/src/agent/session.rs b/src/agent/session.rs index 2b79e77a..0878b397 100644 --- a/src/agent/session.rs +++ b/src/agent/session.rs @@ -252,9 +252,7 @@ pub fn is_approval_authorized(source: Option<&str>, requesting: &str) -> bool { match source { None => false, Some(src) if src == BOOTSTRAP_SOURCE_CHANNEL => true, - Some(src) => { - src == requesting || requesting == "web" || requesting == "gateway" - } + Some(src) => src == requesting || requesting == "web" || requesting == "gateway", } } diff --git a/src/agent/thread_ops.rs b/src/agent/thread_ops.rs index 32bb55f7..60396e31 100644 --- a/src/agent/thread_ops.rs +++ b/src/agent/thread_ops.rs @@ -146,17 +146,18 @@ impl Agent { } else { None }; - let effective_source_channel = db_source_channel - .as_deref() - .or(Some(&*message.channel)); + let effective_source_channel = db_source_channel.as_deref().or(Some(&*message.channel)); let session_id = { let sess = session.lock().await; sess.id }; - let mut thread = - crate::agent::session::Thread::with_id(thread_uuid, session_id, effective_source_channel); + let mut thread = crate::agent::session::Thread::with_id( + thread_uuid, + session_id, + effective_source_channel, + ); if !chat_messages.is_empty() { thread.restore_from_messages(chat_messages); } diff --git a/src/channels/web/handlers/chat.rs b/src/channels/web/handlers/chat.rs index 88d9050d..e0c82957 100644 --- a/src/channels/web/handlers/chat.rs +++ b/src/channels/web/handlers/chat.rs @@ -593,7 +593,13 @@ pub async fn chat_new_thread_handler( // so that the subsequent loadThreads() call from the frontend sees it. if let Some(ref store) = state.store { match store - .ensure_conversation(thread_id, "gateway", &identity.user_id, None, Some("gateway")) + .ensure_conversation( + thread_id, + "gateway", + &identity.user_id, + None, + Some("gateway"), + ) .await { Ok(true) => {} diff --git a/tests/e2e_thread_id_isolation.rs b/tests/e2e_thread_id_isolation.rs index 1d04d848..932ead7e 100644 --- a/tests/e2e_thread_id_isolation.rs +++ b/tests/e2e_thread_id_isolation.rs @@ -48,7 +48,13 @@ mod tests { let store = rig.database(); assert!( store - .ensure_conversation(foreign_thread_id, "gateway", "victim-user", None, Some("gateway")) + .ensure_conversation( + foreign_thread_id, + "gateway", + "victim-user", + None, + Some("gateway") + ) .await .expect("failed to create victim conversation"), "test setup failed: victim conversation was not created"