The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(session_host): cover dynamic prompt rejection before host tools
Steven Enamakeldec8d6beb7d6
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_host_tools_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_host_tools_tests.rsindex 36d9adc52e..783b8f86a5 100644--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_host_tools_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_host_tools_tests.rs@@ -227,6 +227,41 @@ fn the_factory_runs_once_per_session_build() {);}+#[test]+fn invalid_dynamic_prompt_fails_before_the_host_tool_factory_runs() {+ let tmp = tempfile::TempDir::new().unwrap();+ let config = test_config(&tmp);+ let mut definition = definition();+ definition.system_prompt = tinyagents_definition::PromptSource::Dynamic(());+ definition.extensions.prompt_builder = None;+ let calls = Arc::new(AtomicUsize::new(0));+ let host: crate::agent::HostTools = {+ let calls = Arc::clone(&calls);+ Arc::new(move |_| {+ calls.fetch_add(1, Ordering::SeqCst);+ crate::agent::HostTurnTools::default()+ })+ };++ let result = crate::agent::OpenHumanSessionHost::from_config_with_host_tools(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &definition,+ &host,+ None,+ );+ let error = result+ .err()+ .expect("a dynamic prompt without a builder must be rejected");++ assert!(error.to_string().contains("dynamic prompt but has no builder"));+ assert_eq!(+ calls.load(Ordering::SeqCst),+ 0,+ "prompt validation must fail before invoking host code"+ );+}+/// A session built the ordinary way must be byte-identical to before this/// seam existed -- the factory is opt-in, and a `None` host adds nothing.#[test]