Skip to content

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

test(subagent_host): add test for inherited workspace instructions

Steven Enamakel57a16347f114
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_slug_filter_typed_mode_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_slug_filter_typed_mode_tests.rs
index 7516c978c0..4b321f3ad0 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_slug_filter_typed_mode_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_slug_filter_typed_mode_tests.rs
@@ -150,6 +150,60 @@ async fn typed_mode_system_prompt_includes_subagent_role_contract() {
.contains("Do not state unsupported facts; disclose truncated or partial tool results."));
}
+#[tokio::test]
+async fn typed_mode_uses_inherited_workspace_for_project_instructions() {
+ use crate::core::runtime::{CoreContext, DomainSet};
+ use tinytools::WorkspaceDescriptor;
+
+ let scratch = tempfile::tempdir().expect("isolated prompt roots");
+ let action_dir = scratch.path().join("configured-action-root");
+ let workspace_dir = scratch.path().join("workspace");
+ let inherited_root = scratch.path().join("inherited-project");
+ for directory in [&action_dir, &workspace_dir, &inherited_root] {
+ std::fs::create_dir_all(directory).expect("create prompt root");
+ }
+ std::fs::write(
+ action_dir.join("AGENTS.md"),
+ "CONFIG_ACTION_ROOT_INSTRUCTIONS",
+ )
+ .expect("write configured action instructions");
+ std::fs::write(
+ inherited_root.join("AGENTS.md"),
+ "INHERITED_WORKSPACE_INSTRUCTIONS",
+ )
+ .expect("write inherited workspace instructions");
+
+ let mut config = crate::config::Config::default();
+ config.action_dir = action_dir;
+ let core = CoreContext::for_test_with_config(DomainSet::full(), config);
+ let provider = ScriptedProvider::new(vec![text_response("ok")]);
+ let mut parent = make_parent(provider.clone(), vec![stub("file_read")]);
+ parent.workspace_dir = workspace_dir;
+ parent.workspace_descriptor = Some(WorkspaceDescriptor::new(inherited_root));
+ parent.agent_config.agents_md_enabled = true;
+ let options = with_parent(
+ parent,
+ SubagentRunOptions {
+ run_context: crate::agent::tinyagents::host::OpenHumanRunContext::new()
+ .with_core(Some(core)),
+ ..SubagentRunOptions::default()
+ },
+ );
+
+ run_subagent(&make_def_named_tools(&[]), "the requested task", options)
+ .await
+ .expect("subagent run should complete");
+
+ let captured = provider.captured.lock();
+ let system = captured[0]
+ .messages
+ .iter()
+ .find(|message| message.role == "system")
+ .expect("system prompt should be sent");
+ assert!(system.content.contains("INHERITED_WORKSPACE_INSTRUCTIONS"));
+ assert!(!system.content.contains("CONFIG_ACTION_ROOT_INSTRUCTIONS"));
+}
+
#[tokio::test]
async fn typed_mode_returns_text_through_runner() {
let provider = ScriptedProvider::new(vec![text_response("X is Y")]);