Skip to content

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

test(context): add test for parent workspace rebind not moving derived context

Steven Enamakel4689cd7f46c3
diff --git a/crates/openhuman-core/src/core/runtime/context_tests.rs b/crates/openhuman-core/src/core/runtime/context_tests.rs
index c85136f9be..79e9877fc4 100644
--- a/crates/openhuman-core/src/core/runtime/context_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/context_tests.rs
@@ -630,6 +630,8 @@ fn a_derived_context_without_a_memory_override_follows_the_parents_engine_switch
.workspace_binding
.read()
.unwrap()
+ .read()
+ .unwrap()
.memory_subsystem
.driver
.clone();
@@ -654,6 +656,8 @@ fn a_derived_context_with_its_own_memory_config_keeps_the_override() {
.workspace_binding
.read()
.unwrap()
+ .read()
+ .unwrap()
.memory_subsystem
.driver,
"null",
@@ -675,8 +679,42 @@ fn a_derived_context_on_another_workspace_is_not_shared() {
.workspace_binding
.read()
.unwrap()
+ .read()
+ .unwrap()
.memory_subsystem
.driver,
"null"
);
}
+
+#[test]
+fn a_parent_workspace_rebind_does_not_move_a_derived_context() {
+ let parent = ctx("/tmp/shared-before-rebind");
+ let child = parent.derive_with(overlay_for("/tmp/shared-before-rebind", None));
+ let mut next_memory = crate::config::schema::MemorySubsystemConfig::default();
+ next_memory.driver = "null".to_string();
+
+ parent
+ .rebind_workspace(std::path::Path::new("/tmp/next-user"), next_memory)
+ .unwrap();
+
+ assert_eq!(
+ parent.workspace_dir().unwrap(),
+ PathBuf::from("/tmp/next-user")
+ );
+ assert_eq!(
+ child.workspace_dir().unwrap(),
+ PathBuf::from("/tmp/shared-before-rebind")
+ );
+ assert_eq!(
+ child
+ .workspace_binding
+ .read()
+ .unwrap()
+ .read()
+ .unwrap()
+ .memory_subsystem
+ .driver,
+ "tinycortex"
+ );
+}