Skip to content

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

test(agent): add coverage for fleet prompts, builtin registration, fallback chain, and saas runtime

Steven Enamakelf48d3eb29ab0
diff --git a/crates/openhuman-core/src/agent/registry/agents/fleet_prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/fleet_prompt_tests.rs
index 7e02448d08..5ba6035670 100644
--- a/crates/openhuman-core/src/agent/registry/agents/fleet_prompt_tests.rs
+++ b/crates/openhuman-core/src/agent/registry/agents/fleet_prompt_tests.rs
@@ -48,7 +48,8 @@ fn visible_tool_names(def: &AgentDefinition, definitions: &[AgentDefinition]) ->
}
fn render(def: &AgentDefinition, definitions: &[AgentDefinition]) -> String {
- let PromptSource::Dynamic(build) = &def.system_prompt else {
+ let (PromptSource::Dynamic(()), Some(build)) = (&def.system_prompt, def.extensions.prompt_builder)
+ else {
panic!("built-in `{}` must carry a dynamic prompt", def.id);
};
let workspace = tempfile::TempDir::new().expect("temp workspace");
diff --git a/crates/openhuman-core/src/agent/registry/agents/loader_tests_builtin_registration_tests.rs b/crates/openhuman-core/src/agent/registry/agents/loader_tests_builtin_registration_tests.rs
index dcc88a901b..5a8e850c90 100644
--- a/crates/openhuman-core/src/agent/registry/agents/loader_tests_builtin_registration_tests.rs
+++ b/crates/openhuman-core/src/agent/registry/agents/loader_tests_builtin_registration_tests.rs
@@ -158,7 +158,8 @@ fn every_builtin_has_a_prompt_body() {
let empty_visible: std::collections::HashSet<String> = std::collections::HashSet::new();
for def in load_builtins().unwrap() {
match &def.system_prompt {
- PromptSource::Dynamic(build) => {
+ PromptSource::Dynamic(()) => {
+ let build = def.extensions.prompt_builder.expect("dynamic prompt builder");
let ctx = PromptContext {
workspace_dir: std::path::Path::new("."),
model_name: "test",
diff --git a/crates/openhuman-core/src/agent/triage/evaluator_fallback_chain_tests.rs b/crates/openhuman-core/src/agent/triage/evaluator_fallback_chain_tests.rs
index 4df4358fe9..316b3d7680 100644
--- a/crates/openhuman-core/src/agent/triage/evaluator_fallback_chain_tests.rs
+++ b/crates/openhuman-core/src/agent/triage/evaluator_fallback_chain_tests.rs
@@ -45,7 +45,8 @@ fn extract_inline_prompt_returns_body_for_trigger_triage_builtin() {
.find(|b| b.id == TRIGGER_TRIAGE_AGENT_ID)
.expect("trigger_triage built-in must be registered");
let mut def: AgentDefinition = toml::from_str(builtin.toml).expect("TOML must parse");
- def.system_prompt = PromptSource::Dynamic(builtin.prompt_fn);
+ def.system_prompt = PromptSource::Dynamic(());
+ def.extensions.prompt_builder = Some(builtin.prompt_fn);
let body = extract_inline_prompt(&def).expect("body should be present");
assert!(
body.to_lowercase().contains("trigger"),
diff --git a/crates/openhuman-core/src/core/runtime/saas_tests.rs b/crates/openhuman-core/src/core/runtime/saas_tests.rs
index 4f81707d41..5e416fc16a 100644
--- a/crates/openhuman-core/src/core/runtime/saas_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/saas_tests.rs
@@ -134,7 +134,8 @@ fn boot_accepts_a_builtins_only_registry() {
#[test]
fn boot_refuses_a_registry_with_workspace_definitions() {
- use crate::agent::harness::{AgentDefinitionRegistry, DefinitionSource};
+ use crate::agent::harness::host_definition::AgentDefinitionRegistry;
+ use tinyagents_definition::DefinitionSource;
let mut custom = AgentDefinitionRegistry::builtins_only()
.get("orchestrator")
.cloned()