Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(orchestration): track busy turns per session in background delivery tests

Steven Enamakel433b03295946
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery_tests.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery_tests.rs
index 23faa10880..38bb817da6 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_delivery_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery_tests.rs
@@ -32,16 +32,19 @@ fn pending_ids(ws: &Path, thread: &str) -> Vec<String> {
}
fn mark_busy(session: &str) {
- busy()
+ static TURNS: std::sync::OnceLock<std::sync::Mutex<std::collections::HashMap<String, TurnBusy>>> =
+ std::sync::OnceLock::new();
+ TURNS
+ .get_or_init(Default::default)
.lock()
- .expect("busy")
- .entry(session.to_string())
- .or_default()
- .insert(u64::MAX);
+ .expect("test turns")
+ .insert(session.to_owned(), TurnBusy::start(&cx(), session));
}
fn clear_busy(session: &str) {
- busy().lock().expect("busy").remove(session);
+ static TURNS: std::sync::OnceLock<std::sync::Mutex<std::collections::HashMap<String, TurnBusy>>> =
+ std::sync::OnceLock::new();
+ TURNS.get_or_init(Default::default).lock().expect("test turns").remove(session);
}
#[tokio::test]