Skip to content

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

refactor(core): update context creation for tests

Steven Enamakela16459caaf61
diff --git a/crates/openhuman-core/src/core/runtime/context_test_support.rs b/crates/openhuman-core/src/core/runtime/context_test_support.rs
index f1382afe3d..2dfe2064c1 100644
--- a/crates/openhuman-core/src/core/runtime/context_test_support.rs
+++ b/crates/openhuman-core/src/core/runtime/context_test_support.rs
@@ -51,7 +51,26 @@ impl CoreContext {
workspace_dir: Option<std::path::PathBuf>,
extensions: crate::core::slots::Extensions,
) -> Arc<CoreContext> {
- let mut ctx = Arc::try_unwrap(Self::for_test(domains, workspace_dir))
+ Self::for_test_with_host_kind_and_extensions(
+ HostKind::Cli,
+ domains,
+ workspace_dir,
+ extensions,
+ )
+ }
+
+ /// Test-only constructor with explicit host policy and scoped registrations.
+ pub(crate) fn for_test_with_host_kind_and_extensions(
+ host_kind: HostKind,
+ domains: crate::core::runtime::DomainSet,
+ workspace_dir: Option<std::path::PathBuf>,
+ extensions: crate::core::slots::Extensions,
+ ) -> Arc<CoreContext> {
+ let mut ctx = Arc::try_unwrap(Self::for_test_with_host_kind(
+ host_kind,
+ domains,
+ workspace_dir,
+ ))
.ok()
.unwrap();
ctx.extensions = extensions;
diff --git a/crates/openhuman-core/src/inference/turn_models_tests.rs b/crates/openhuman-core/src/inference/turn_models_tests.rs
index 8f615b9631..a5312bb75b 100644
--- a/crates/openhuman-core/src/inference/turn_models_tests.rs
+++ b/crates/openhuman-core/src/inference/turn_models_tests.rs
@@ -177,16 +177,12 @@ async fn explicit_provider_string_turn_source_uses_scoped_managed_model() {
provider,
scoped_model_entry("explicit-provider-model", false),
);
- let explicit_context = CoreContext::for_test_with_host_kind(
+ let explicit_context = CoreContext::for_test_with_host_kind_and_extensions(
HostKind::Library,
DomainSet::full(),
None,
+ explicit_extensions,
);
- let explicit_context = {
- let mut context = Arc::try_unwrap(explicit_context).ok().unwrap();
- context.extensions = explicit_extensions;
- Arc::new(context)
- };
let ambient_context = CoreContext::for_test_with_host_kind(
HostKind::Library,
DomainSet::full(),