Skip to content

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

fix(mcp): drop redundant agent context check in client cache

Steven Enamakel5989aa307c46
diff --git a/crates/openhuman-core/src/mcp/module_client.rs b/crates/openhuman-core/src/mcp/module_client.rs
index 6026b323be..703489d735 100644
--- a/crates/openhuman-core/src/mcp/module_client.rs
+++ b/crates/openhuman-core/src/mcp/module_client.rs
@@ -287,7 +287,7 @@ impl McpConfiguredClient {
.unwrap_or_else(std::sync::PoisonError::into_inner);
// The cleanup reservation can be installed after the first check but
// before this cache lock is acquired. Recheck before creating a client.
- if current_agent_context_is_removed() || Self::cleanup_pending(&data_dir) {
+ if Self::cleanup_pending(&data_dir) {
ModuleClient::report_unavailable(MODULE);
return Err(ModuleCallError::Unavailable);
}
diff --git a/crates/openhuman-core/src/mcp/module_client_tests.rs b/crates/openhuman-core/src/mcp/module_client_tests.rs
index 11fda1af93..7c1ee48f13 100644
--- a/crates/openhuman-core/src/mcp/module_client_tests.rs
+++ b/crates/openhuman-core/src/mcp/module_client_tests.rs
@@ -675,10 +675,11 @@ async fn a_removed_context_waiting_for_the_client_cache_cannot_reopen_it() {
scope.close("agent_removed");
drop(clients_lock);
- assert!(matches!(
- request.await.unwrap(),
- Err(ModuleCallError::Unavailable)
- ));
+ let admitted = request.await.unwrap().is_ok();
+ if admitted {
+ clients.lock().unwrap().remove(&scoped_dir);
+ }
+ assert!(!admitted, "removed context must not create a cached client");
assert!(!clients.lock().unwrap().contains_key(&scoped_dir));
}