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(agent): register turn progress release test module
Steven Enamakel4ea50bce1945
diff --git a/crates/openhuman-core/src/agent/agent_tests.rs b/crates/openhuman-core/src/agent/agent_tests.rsindex c764f4e787..3584d9ded6 100644--- a/crates/openhuman-core/src/agent/agent_tests.rs+++ b/crates/openhuman-core/src/agent/agent_tests.rs@@ -294,3 +294,5 @@ mod agent_turn_loop_nudge_tests;mod agent_turn_loop_packed_tool_tests;#[path = "agent_turn_loop_tests.rs"]mod agent_turn_loop_tests;+#[path = "agent_turn_progress_release_tests.rs"]+mod agent_turn_progress_release_tests;diff --git a/crates/openhuman-core/src/agent/agent_turn_progress_release_tests.rs b/crates/openhuman-core/src/agent/agent_turn_progress_release_tests.rsnew file mode 100644index 0000000000..447e6de927--- /dev/null+++ b/crates/openhuman-core/src/agent/agent_turn_progress_release_tests.rs@@ -0,0 +1,30 @@+//! A finished turn must release every clone of its progress sender once the+//! caller clears the sink, so the web channel's progress bridge (which only+//! exits when its receiver closes) does not outlive the turn on a cached+//! session.++use super::*;++#[tokio::test]+async fn clearing_progress_after_a_turn_closes_the_receiver() {+ let provider = Arc::new(ScriptedProvider::new(vec![text_response("Hello world")]));+ let (mut agent, _tmp) =+ build_agent_with(provider, vec![Box::new(EchoTool)], Box::new(NativeDialect));++ let (tx, mut rx) = tokio::sync::mpsc::channel(256);+ let weak = tx.downgrade();+ agent.set_on_progress(Some(tx));+ agent.turn("hi").await.expect("turn");+ agent.set_on_progress(None);++ eprintln!("DIAG strong_count after clear = {}", weak.strong_count());+ while rx.try_recv().is_ok() {}+ assert!(+ matches!(+ rx.try_recv(),+ Err(tokio::sync::mpsc::error::TryRecvError::Disconnected)+ ),+ "a cached session kept {} progress sender clone(s) alive after the turn",+ weak.strong_count()+ );+}