Skip to content

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

fix(mcp): avoid holding workspace borrow across await in close test

Steven Enamakel8ad0e0e1351f
diff --git a/crates/openhuman-core/src/mcp/module_client.rs b/crates/openhuman-core/src/mcp/module_client.rs
index c36bf2dc66..8b9d1db405 100644
--- a/crates/openhuman-core/src/mcp/module_client.rs
+++ b/crates/openhuman-core/src/mcp/module_client.rs
@@ -431,7 +431,7 @@ impl McpConfiguredClient {
}
fn retire_cached_client(data_dir: &std::path::Path) -> Option<Arc<Self>> {
- let mut clients = CLIENTS.get().map(|clients| {
+ let clients = CLIENTS.get().map(|clients| {
clients
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner)
diff --git a/crates/openhuman-core/src/mcp/module_client_tests.rs b/crates/openhuman-core/src/mcp/module_client_tests.rs
index 95a99d468c..2fc8705d32 100644
--- a/crates/openhuman-core/src/mcp/module_client_tests.rs
+++ b/crates/openhuman-core/src/mcp/module_client_tests.rs
@@ -507,7 +507,9 @@ async fn agent_id_stays_unavailable_until_its_cached_module_close_is_acknowledge
.await
.unwrap();
- let closing = tokio::spawn(crate::mcp::host::close_agent(workspace.path(), "alpha"));
+ let workspace_path = workspace.path().to_path_buf();
+ let closing =
+ tokio::spawn(async move { crate::mcp::host::close_agent(&workspace_path, "alpha").await });
alpha_port.close_started.notified().await;
assert!(crate::mcp::host::agent_close_pending(
workspace.path(),
diff --git a/crates/openhuman-embed/src/runtime/mod.rs b/crates/openhuman-embed/src/runtime/mod.rs
index 332856bb01..335449902e 100644
--- a/crates/openhuman-embed/src/runtime/mod.rs
+++ b/crates/openhuman-embed/src/runtime/mod.rs
@@ -365,10 +365,7 @@ impl Runtime {
let cleanup_pending = {
#[cfg(feature = "mcp")]
{
- openhuman_core::mcp::host::agent_close_pending(
- &self.base_config.workspace_dir,
- &id,
- )
+ openhuman_core::mcp::host::agent_close_pending(&self.base_config.workspace_dir, &id)
}
#[cfg(not(feature = "mcp"))]
{