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(mcp): add hook to observe context check in module client
Steven Enamakeld7e4b3877d8a
diff --git a/crates/openhuman-core/src/mcp/module_client.rs b/crates/openhuman-core/src/mcp/module_client.rsindex 6a8c37d804..0674ef30fa 100644--- a/crates/openhuman-core/src/mcp/module_client.rs+++ b/crates/openhuman-core/src/mcp/module_client.rs@@ -47,6 +47,10 @@ static CLEANUP_RESERVATIONS: OnceLock<Mutex<HashMap<PathBuf, Arc<CleanupReservatstatic SHUTDOWN_REGISTERED: AtomicBool = AtomicBool::new(false);static SHUTTING_DOWN: AtomicBool = AtomicBool::new(false);+#[cfg(test)]+static AFTER_CONTEXT_CHECK: OnceLock<Mutex<Option<tokio::sync::oneshot::Sender<()>>>> =+ OnceLock::new();+#[derive(Clone)]struct OpenObject {config: McpClientConfig,@@ -258,9 +262,18 @@ impl McpConfiguredClient {ModuleClient::report_unavailable(MODULE);return Err(ModuleCallError::Unavailable);}+ #[cfg(test)]+ if let Some(sender) = AFTER_CONTEXT_CHECK+ .get_or_init(|| Mutex::new(None))+ .lock()+ .unwrap_or_else(std::sync::PoisonError::into_inner)+ .take()+ {+ let _ = sender.send(());+ }let data_dir = crate::core::runtime::agent_scope_dir(config);- if Self::cleanup_pending(&data_dir) {+ if current_agent_context_is_removed() || Self::cleanup_pending(&data_dir) {return Err(ModuleCallError::Unavailable);}let clients = CLIENTS.get_or_init(|| Mutex::new(HashMap::new()));