Skip to content

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

chore: files changed crates/openhuman-core/src/core/runtime/context_tests.rs

Steven Enamakele421d1a5604e
diff --git a/crates/openhuman-core/src/core/runtime/context_tests.rs b/crates/openhuman-core/src/core/runtime/context_tests.rs
index 4f2ae9df32..c2620a38ea 100644
--- a/crates/openhuman-core/src/core/runtime/context_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/context_tests.rs
@@ -86,6 +86,21 @@ async fn the_current_dispatch_sees_the_scoped_embedder_config() {
assert_eq!(scoped.workspace_dir, PathBuf::from("/tmp/scoped-ws"));
}
+#[test]
+fn a_synchronous_scope_serves_its_context_to_blocking_readers() {
+ // The session builder is synchronous and reads the ambient context while
+ // it assembles a belt; a host agent's session has to be built inside its
+ // own context, not the process default.
+ let mut config = crate::config::Config::default();
+ config.default_model = Some("sync-scoped-model".into());
+
+ let seen = CoreContext::sync_scope(ctx_with_config(config), || {
+ CoreContext::current_embedder_config().and_then(|config| config.default_model)
+ });
+
+ assert_eq!(seen.as_deref(), Some("sync-scoped-model"));
+}
+
#[tokio::test]
async fn the_current_embedder_config_can_be_read_without_cloning_it() {
// `with_current_embedder_config` is the borrow-only twin of