Skip to content

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

test(config): cover explicit context precedence over task scope

Steven Enamakel4c1d1ac41bfb
diff --git a/crates/openhuman-core/src/config/ops/loader_current_tests.rs b/crates/openhuman-core/src/config/ops/loader_current_tests.rs
index 997f0b8f80..5100821b9e 100644
--- a/crates/openhuman-core/src/config/ops/loader_current_tests.rs
+++ b/crates/openhuman-core/src/config/ops/loader_current_tests.rs
@@ -55,3 +55,17 @@ async fn a_context_without_a_route_loads_unchanged_providers() {
Some(format!("{EPHEMERAL_ROUTE_SLUG}:ctx-model").as_str())
);
}
+
+#[tokio::test]
+async fn the_explicit_context_wins_over_the_tasks_scope_and_tenants_do_not_cross() {
+ let mut other = base_config();
+ other.default_model = Some("other-model".to_string());
+ let scoped = context_with(other);
+ let explicit = DispatchCtx::new(context_with(base_config()));
+
+ let loaded = CoreContext::scope(scoped, async { load_current_or_init(&explicit).await })
+ .await
+ .expect("explicit context config loads");
+
+ assert_eq!(loaded.default_model.as_deref(), Some("ctx-model"));
+}