Skip to content

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

fix(ci): port composio, approval and scope-gating e2e tests to host storage

M3gA-Mindab26945af05a
diff --git a/tests/raw_coverage/composio_raw_coverage_e2e.rs b/tests/raw_coverage/composio_raw_coverage_e2e.rs
index 631f633fa0..be6d60c0e6 100644
--- a/tests/raw_coverage/composio_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/composio_raw_coverage_e2e.rs
@@ -95,6 +95,12 @@ async fn composio_connected_integrations_public_helpers_handle_empty_auth_and_id
#[tokio::test]
async fn composio_ops_mode_is_local_and_trigger_history_reads_the_module_archive() {
let _module = crate::CONNECTOR_MODULE_LOCK.lock().await;
+ // The connector module keeps the trigger archive in host storage.
+ let env_lock = ENV_LOCK
+ .get_or_init(|| tokio::sync::Mutex::new(()))
+ .lock()
+ .await;
+ let _storage = crate::HostStorage::install(&env_lock);
crate::tinyhumans_boot::boot();
let dir = tempdir().expect("tempdir");
let mut config = Config {
@@ -197,10 +203,12 @@ fn composio_client_factory_modes_are_deterministic_without_network() {
#[tokio::test]
async fn composio_controller_registry_and_scope_handlers_cover_validation_edges() {
- let _env_lock = ENV_LOCK
+ let env_lock = ENV_LOCK
.get_or_init(|| tokio::sync::Mutex::new(()))
.lock()
.await;
+ // Scope preferences live in the connector module's host storage.
+ let _storage = crate::HostStorage::install(&env_lock);
crate::tinyhumans_boot::boot();
// The controller loads config through the process workspace resolver. Pin
// the test to an isolated workspace so the scope store does not depend on
@@ -247,14 +255,14 @@ async fn composio_controller_registry_and_scope_handlers_cover_validation_edges(
.await
.expect_err("write must be bool");
assert!(invalid_write.contains("invalid 'write'"));
- // The storage half persists to `<workspace>/integrations/composio_user_scopes.json`
- // (no memory driver involved) and reads back through `get_user_scopes`.
+ // The pref persists in the connector module's host storage (b80c12358a)
+ // and reads back through `get_user_scopes`.
let saved = composio_call(
set_scopes,
json!({ "toolkit": " GitHub ", "read": true, "write": false, "admin": true }),
)
.await
- .expect("set_user_scopes persists to the workspace file store");
+ .expect("set_user_scopes persists to host storage");
assert_eq!(saved.pointer("/admin"), Some(&json!(true)));
assert_eq!(saved.pointer("/write"), Some(&json!(false)));
let reread = composio_call(get_scopes, json!({ "toolkit": "github" }))
@@ -263,11 +271,11 @@ async fn composio_controller_registry_and_scope_handlers_cover_validation_edges(
assert_eq!(reread.pointer("/admin"), Some(&json!(true)));
assert_eq!(reread.pointer("/write"), Some(&json!(false)));
assert!(
- workspace_dir
+ !workspace_dir
.join("integrations")
.join("composio_user_scopes.json")
.exists(),
- "the pref lands in the workspace file store"
+ "the legacy workspace file is no longer written"
);
}
diff --git a/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs b/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs
index c1fd2392c4..3ab13efe8f 100644
--- a/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs
@@ -1011,11 +1011,15 @@ async fn approval_rpc_decision_paths_persist_always_allow_and_recent_audit() {
let second_init = ApprovalGate::init_global(Config::default(), "session-ignored-second");
assert_eq!(second_init.session_id(), gate.session_id());
- let approval_dir = config.workspace_dir.join("approval");
- if approval_dir.exists() {
- std::fs::remove_dir_all(&approval_dir).expect("remove approval dir before failure branch");
+ // Approvals are documents in the workspace's default storage database
+ // (`sqlite:<workspace>/storage`, 5995128210). Drop the cached handle and
+ // block that directory, so the store's next open fails.
+ openhuman_core::storage::local::forget(&config.workspace_dir);
+ let storage_dir = config.workspace_dir.join("storage");
+ if storage_dir.exists() {
+ std::fs::remove_dir_all(&storage_dir).expect("remove storage dir before failure branch");
}
- std::fs::write(&approval_dir, "not a directory").expect("replace approval dir with file");
+ std::fs::write(&storage_dir, "not a directory").expect("replace storage dir with file");
gate.record_execution(
&request_id,
diff --git a/tests/raw_coverage/tools_composio_network_leftovers_raw_coverage_e2e.rs b/tests/raw_coverage/tools_composio_network_leftovers_raw_coverage_e2e.rs
index ba75845cb7..08a9b3177c 100644
--- a/tests/raw_coverage/tools_composio_network_leftovers_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/tools_composio_network_leftovers_raw_coverage_e2e.rs
@@ -257,7 +257,15 @@ async fn round20_composio_ops_cover_authorize_scopes() {
.await
.expect("ops list tools")
.value;
- assert_eq!(listed.tools.len(), 2);
+ // The connector module lists only curated actions (b80c12358a): its
+ // GitHub catalog has no GITHUB_STAR_REPOSITORY, so the mock's second
+ // tool is gated out.
+ let names: Vec<&str> = listed
+ .tools
+ .iter()
+ .map(|tool| tool.function.name.as_str())
+ .collect();
+ assert_eq!(names, ["GMAIL_FETCH_EMAILS"]);
let requests = state.requests.lock().expect("requests").clone();
let authorize_body = requests
diff --git a/tests/raw_coverage_all.rs b/tests/raw_coverage_all.rs
index e58792ac58..4d4e359629 100644
--- a/tests/raw_coverage_all.rs
+++ b/tests/raw_coverage_all.rs
@@ -44,6 +44,36 @@ pub static SHARED_ENV_LOCK: OnceLock<tokio::sync::Mutex<()>> = OnceLock::new();
/// which is `cfg(test)`-only; this is the integration-binary equivalent.
pub static CONNECTOR_MODULE_LOCK: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(());
+/// A host storage backend, installed for one test and removed on drop (also
+/// when the test panics).
+///
+/// Modules reach host storage only through the installed backend
+/// (`modules::storage_host`), as they do under a real host's boot; these
+/// suites boot none. The slot is process-wide and libtest runs this binary's
+/// tests in one process, so taking the [`SHARED_ENV_LOCK`] guard serializes
+/// every install. A test that holds no lock can still observe the backend
+/// while one is installed.
+pub struct HostStorage<'lock>(std::marker::PhantomData<&'lock ()>);
+
+impl<'lock> HostStorage<'lock> {
+ pub fn install(_env: &'lock tokio::sync::MutexGuard<'_, ()>) -> Self {
+ let previous = openhuman_core::storage::install(std::sync::Arc::new(
+ openhuman_core::storage::MemoryStorage::new(),
+ ));
+ assert!(
+ previous.is_none(),
+ "a host storage backend was left installed"
+ );
+ Self(std::marker::PhantomData)
+ }
+}
+
+impl Drop for HostStorage<'_> {
+ fn drop(&mut self) {
+ openhuman_core::storage::clear();
+ }
+}
+
/// The TinyHumans backend transport for every aggregated suite that boots the
/// core in-process and reaches the mock backend: call
/// `crate::tinyhumans_boot::boot()` from the suite's fixture (or each test).