The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(channels): consolidate clear-history route tests
Steven Enamakel40298f1c0a08
diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rsindex 553cb3ed27..9212c0ae2e 100644--- a/crates/openhuman-core/src/channels/routes_tests.rs+++ b/crates/openhuman-core/src/channels/routes_tests.rs@@ -345,7 +345,7 @@ async fn handle_runtime_command_unknown_provider_sends_helpful_error() {}#[tokio::test]-async fn handle_runtime_command_set_model_clears_sender_history_and_persists_route_override() {+async fn clear_history_command_uses_reset_callback_and_persists_route_override() {let ctx = runtime_context(PathBuf::from("/tmp"));let key = "telegram_alice_room";ctx.conversation_histories@@ -367,21 +367,23 @@ async fn handle_runtime_command_set_model_clears_sender_history_and_persists_rousender_name: None,};- let handled = handle_runtime_command_if_needed(+ let reset_called = Arc::new(std::sync::atomic::AtomicBool::new(false));+ let callback_flag = Arc::clone(&reset_called);+ let handled = handle_runtime_command_with_reset(&ctx,&msg,Some(&channel),&conversation_history_key(&msg),+ move || async move {+ callback_flag.store(true, std::sync::atomic::Ordering::SeqCst);+ Ok(())+ },).await;assert!(handled);+ assert!(reset_called.load(std::sync::atomic::Ordering::SeqCst));- assert!(ctx- .conversation_histories- .lock()- .unwrap()- .get(key)- .is_none());+ assert!(ctx.conversation_histories.lock().unwrap().contains_key(key));assert_eq!(get_route_selection(&ctx, key),ChannelRouteSelection {@@ -395,54 +397,6 @@ async fn handle_runtime_command_set_model_clears_sender_history_and_persists_rouassert!(sent[0].content.contains("Model switched to `gpt-5-mini`"));}-#[tokio::test]-async fn clear_history_command_uses_durable_reset_callback_without_clearing_ram_history() {- let ctx = runtime_context(PathBuf::from("/tmp"));- let key = "telegram_alice_room";- ctx.conversation_histories- .lock()- .unwrap()- .insert(key.to_string(), vec![ChatMessage::user("old history")]);- let channel_impl = Arc::new(RecordingChannel::default());- let channel: Arc<dyn Channel> = channel_impl.clone();- let msg = ChannelMessage {- reply_to_id: None,- topic_id: None,- id: "reset-1".into(),- sender: "alice".into(),- reply_target: "room".into(),- content: "/model gpt-5-mini".into(),- channel: "telegram".into(),- timestamp: 0,- thread_ts: None,- sender_name: None,- };- let reset_called = Arc::new(std::sync::atomic::AtomicBool::new(false));- let reset_called_by_callback = Arc::clone(&reset_called);-- let handled = handle_runtime_command_with_reset(- &ctx,- &msg,- Some(&channel),- &conversation_history_key(&msg),- move || async move {- reset_called_by_callback.store(true, std::sync::atomic::Ordering::SeqCst);- Ok(())- },- )- .await;-- assert!(handled);- assert!(reset_called.load(std::sync::atomic::Ordering::SeqCst));- assert!(ctx.conversation_histories.lock().unwrap().contains_key(key));- assert_eq!(- get_route_selection(&ctx, key).model,- "gpt-5-mini",- "route changes are applied before the durable reset callback runs"- );- assert_eq!(channel_impl.sent.lock().unwrap().len(), 1);-}-#[tokio::test]async fn handle_runtime_command_telegram_status_replies_without_agent() {let ctx = runtime_context(PathBuf::from("/tmp"));