Skip to content

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

test(composio): drop redundant storage slot lock in scope gate test

Steven Enamakela4507d0f43a1
diff --git a/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs b/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs
index 04b6b7f490..0d2a9248bc 100644
--- a/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/tools/scope_gate_tests.rs
@@ -218,18 +218,6 @@ async fn a_preference_still_in_the_legacy_file_gates_execution() {
));
}
-/// Puts back whatever storage backend the process had when dropped.
-struct RestoreInstalledStorage(Option<std::sync::Arc<dyn crate::storage::StorageBackend>>);
-
-impl Drop for RestoreInstalledStorage {
- fn drop(&mut self) {
- crate::storage::clear();
- if let Some(previous) = self.0.take() {
- crate::storage::install(previous);
- }
- }
-}
-
/// The wiring, not only the fallback value: when the connector module cannot
/// read a stored preference, every gate that consults it denies.
///
@@ -237,24 +225,20 @@ impl Drop for RestoreInstalledStorage {
/// preference while a backend is installed connects that link; removing the
/// backend then makes the module's next preference read fail (`Unavailable`),
/// as a storage outage would.
+///
+/// `module_guard` already holds the storage slot and installs a memory backend
+/// (restored on drop), so the test must not lock the slot a second time: the
+/// slot mutex is not reentrant and doing so deadlocks.
#[tokio::test]
-#[allow(
- clippy::await_holding_lock,
- reason = "the storage-slot guard must cover the whole test; the runtime is current-thread"
-)]
async fn an_unreadable_preference_denies_at_every_gate() {
use crate::integrations::composio::module_client::module_guard;
let _serialised = module_guard().await;
- let _slot = crate::storage::test_support::lock_storage_slot();
let ctx = crate::core::runtime::DispatchCtx::ambient();
let tmp = tempfile::tempdir().unwrap();
let mut config = Config::default();
config.workspace_dir = tmp.path().join("workspace");
config.config_path = tmp.path().join("config.toml");
- let restore = RestoreInstalledStorage(crate::storage::install(
- crate::storage::test_support::memory_backend(),
- ));
crate::integrations::composio::ops::save_user_scope_pref(
&ctx,
&config,
@@ -291,5 +275,4 @@ async fn an_unreadable_preference_denies_at_every_gate() {
),
"the execute gate must block a write action on an unreadable pref"
);
- drop(restore);
}