Skip to content

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

test: boot default core context in composio e2e setups

Steven Enamakelced1b9daf6ae
diff --git a/tests/raw_coverage/composio_backend_tools_e2e.rs b/tests/raw_coverage/composio_backend_tools_e2e.rs
index 3acee73940..3507ef9d47 100644
--- a/tests/raw_coverage/composio_backend_tools_e2e.rs
+++ b/tests/raw_coverage/composio_backend_tools_e2e.rs
@@ -94,6 +94,7 @@ async fn setup_config() -> Harness {
config.secrets.encrypt = false;
config.observability.analytics_enabled = false;
config.save().await.expect("save config");
+ crate::tinyhumans_boot::boot_default_context(config.clone()).await;
Harness {
_tmp: tmp,
diff --git a/tests/raw_coverage/composio_direct_tools_e2e.rs b/tests/raw_coverage/composio_direct_tools_e2e.rs
index 45462dfe54..48aa8dbc93 100644
--- a/tests/raw_coverage/composio_direct_tools_e2e.rs
+++ b/tests/raw_coverage/composio_direct_tools_e2e.rs
@@ -103,6 +103,7 @@ async fn setup_direct_config(base: &str) -> Harness {
config.secrets.encrypt = false;
config.observability.analytics_enabled = false;
config.save().await.expect("save config");
+ crate::tinyhumans_boot::boot_default_context(config.clone()).await;
Harness {
_tmp: tmp,
diff --git a/tests/support/tinyhumans_boot.rs b/tests/support/tinyhumans_boot.rs
index 0fd382ce15..b4167a3a74 100644
--- a/tests/support/tinyhumans_boot.rs
+++ b/tests/support/tinyhumans_boot.rs
@@ -32,3 +32,29 @@ pub fn boot() {
pub fn is_booted() -> bool {
BOOT.is_completed()
}
+
+/// Boot the process's default core context over `config`, once.
+///
+/// Modules reach host services (the storage bus) through the ambient dispatch
+/// context, which in a headless process is the default context a real host
+/// always builds. A test that calls domain ops directly has none unless an
+/// earlier test in the same process happened to build one, so under per-test
+/// processes (nextest) it must boot one itself.
+pub async fn boot_default_context(config: openhuman_core::config::Config) {
+ use openhuman_core::core::runtime::{CoreContext, DomainSet, TokenSource};
+ if CoreContext::default_context().is_some() {
+ return;
+ }
+ openhuman_core::core::bus::init()
+ .await
+ .expect("init the event bus");
+ CoreContext::init_with_config(
+ openhuman_core::core::types::HostKind::Library,
+ &TokenSource::Fixed(std::sync::Arc::new("test-token".to_string())),
+ DomainSet::full(),
+ openhuman_core::tools::toolpacks::ToolGroups::none(),
+ Some(config),
+ )
+ .await
+ .expect("boot the default core context");
+}