Skip to content

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

test(subagent-host): move prompt tests into a dedicated file

Steven Enamakeled15a8bb626d
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/prompt.rs b/crates/openhuman-core/src/agent/subagent_host/ops/prompt.rs
index 9bbaf8b85a..1de1dea4d0 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/prompt.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/prompt.rs
@@ -30,32 +30,8 @@ pub(crate) fn compose_subagent_system_prompt(
}
#[cfg(test)]
-mod tests {
- use super::*;
-
- #[test]
- fn prompt_framing_matches_the_child_spawn_surface() {
- let nested = ["spawn_subagent".to_owned()].into_iter().collect();
- let nested_prompt = compose_subagent_system_prompt(
- "Worker instructions".into(),
- "worker",
- &nested,
- "complete the task",
- 1,
- );
- assert!(nested_prompt.contains("You may delegate parts of the work"));
- assert!(!nested_prompt.contains("You are a leaf worker"));
-
- let leaf_prompt = compose_subagent_system_prompt(
- "Worker instructions".into(),
- "worker",
- &HashSet::new(),
- "complete the task",
- 1,
- );
- assert!(leaf_prompt.contains("You are a leaf worker"));
- }
-}
+#[path = "prompt_tests.rs"]
+mod tests;
/// Append the filesystem-offload contract (#3883), but only for a sub-agent
/// that actually holds a file-write tool.
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/prompt_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops/prompt_tests.rs
new file mode 100644
index 0000000000..269a905889
--- /dev/null
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/prompt_tests.rs
@@ -0,0 +1,24 @@
+use super::*;
+
+#[test]
+fn prompt_framing_matches_the_child_spawn_surface() {
+ let nested = ["spawn_subagent".to_owned()].into_iter().collect();
+ let nested_prompt = compose_subagent_system_prompt(
+ "Worker instructions".into(),
+ "worker",
+ &nested,
+ "complete the task",
+ 1,
+ );
+ assert!(nested_prompt.contains("You may delegate parts of the work"));
+ assert!(!nested_prompt.contains("You are a leaf worker"));
+
+ let leaf_prompt = compose_subagent_system_prompt(
+ "Worker instructions".into(),
+ "worker",
+ &HashSet::new(),
+ "complete the task",
+ 1,
+ );
+ assert!(leaf_prompt.contains("You are a leaf worker"));
+}