Skip to content

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

refactor(tests): update agent names in various tests

Steven Enamakeld895ff87e1a3
diff --git a/crates/openhuman-core/src/agent/orchestration/README.md b/crates/openhuman-core/src/agent/orchestration/README.md
index f403ae197b..b00f0dbf7d 100644
--- a/crates/openhuman-core/src/agent/orchestration/README.md
+++ b/crates/openhuman-core/src/agent/orchestration/README.md
@@ -28,7 +28,7 @@ and UI-facing projections.
- `subagent_control.rs`: manual cancel and steer RPCs.
- `subagent_sessions/`: durable session reuse and deduplication.
- `parent_context/builder.rs`: construction for tasks without a parent turn.
-- `worktree.rs` and `worktree_schemas.rs`: worktree adapter and RPCs.
+- `worktree.rs` and `../../agent_runs/worktree_schemas.rs`: worktree adapter and RPCs.
- `delegation.rs`: live TinyAgents delegation graph adapter.
- `tools.rs`: callable sub-agent tools.
@@ -58,7 +58,7 @@ sandbox context, spawn depth, and progress derive from the parent
## Used by
-- `crate::tools` re-exports the callable tools.
+- `agent/registration.rs` registers the callable tools; `tools::ops` composes that family.
- `threads` cancels detached work when a thread closes.
- `crate::core::all` registers the remaining controller pairs.
- The frontend uses the background run and sub-agent controls.
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs
index d6b7454ff8..de3d8adf23 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs
@@ -199,11 +199,13 @@ fn named_belt_without_tool_search_reaches_no_deferred_tool() {
}
/// A hand-written `[tools] named` belt is left exactly as written: exposure is
-/// only for the wildcard belt. `critic` names `file_read` among its tools; it
-/// must keep it and gain nothing a wildcard would add.
+/// only for the wildcard belt. This test-owned definition names `file_read`;
+/// it must keep that tool and gain nothing a wildcard would add.
#[test]
fn named_belt_keeps_its_listed_members() {
- let visible = visible_names("critic");
+ let mut definition = super::wildcard_probe_def();
+ definition.tools = tinyagents_definition::ToolScope::Named(vec!["file_read".to_owned()]);
+ let visible = visible_names_for(&definition);
assert!(
visible.contains("file_read"),
"named belt must keep the members it lists; got {visible:?}"
diff --git a/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs b/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs
index 4b0bcb2035..053c85d82c 100644
--- a/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/tool_prep.rs
@@ -43,6 +43,14 @@ pub(crate) fn subagent_prompt_protocol(
/// The shared static names stay aligned with TinyAgents; registry lookup is
/// needed only for host-defined, unprefixed `delegate_name` overrides.
pub(super) fn is_subagent_spawn_tool(name: &str) -> bool {
+ let registry = crate::agent_registry::host_definition::AgentDefinitionRegistry::current();
+ is_subagent_spawn_tool_with_registry(name, registry.as_deref())
+}
+
+fn is_subagent_spawn_tool_with_registry(
+ name: &str,
+ registry: Option<&crate::agent_registry::host_definition::AgentDefinitionRegistry>,
+) -> bool {
if crate::agent::tinyagents::turn_policy::is_subagent_spawn_or_delegate_tool(name) {
return true;
}
@@ -53,9 +61,7 @@ pub(super) fn is_subagent_spawn_tool(name: &str) -> bool {
// which let wildcard-scoped children inherit the orchestrator's spawn
// surface. Resolve the override names via the registry so the strip
// stays in lockstep with `collect_orchestrator_tools`'s naming.
- if let Some(registry) =
- crate::agent_registry::host_definition::AgentDefinitionRegistry::current()
- {
+ if let Some(registry) = registry {
return registry
.list()
.iter()
diff --git a/crates/openhuman-core/src/agent/subagent_host/tool_prep_tests.rs b/crates/openhuman-core/src/agent/subagent_host/tool_prep_tests.rs
index 46d168816e..83e52ca22c 100644
--- a/crates/openhuman-core/src/agent/subagent_host/tool_prep_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/tool_prep_tests.rs
@@ -48,14 +48,20 @@ fn unprefixed_delegate_name_overrides_are_treated_as_spawn_tools() {
// `delegate_name` override (`plan`, `manage_tasks`, `create_image`, …).
// They must be stripped from every sub-agent surface, exactly like
// the `delegate_*`-prefixed defaults.
- let tmp = tempfile::TempDir::new().unwrap();
- crate::agent_registry::host_definition::AgentDefinitionRegistry::init_global(tmp.path())
- .unwrap();
+ let mut registry = crate::agent_registry::host_definition::AgentDefinitionRegistry::builtins_only();
+ let mut plan_alias = registry
+ .get("orchestrator")
+ .expect("built-in orchestrator")
+ .clone();
+ plan_alias.id = "test_plan_alias".to_string();
+ plan_alias.delegate_name = Some("plan".to_string());
+ registry.insert(plan_alias);
for delegate in [
"plan",
- "review_code",
"manage_tasks",
"create_image",
+ "build_workflow",
+ "discover_workflows",
// `make_presentation` is `presentation_agent`'s `delegate_name`; the agent —
// and therefore this delegate tool — is compiled out with the
// `documents` feature.
@@ -63,7 +69,7 @@ fn unprefixed_delegate_name_overrides_are_treated_as_spawn_tools() {
"make_presentation",
] {
assert!(
- is_subagent_spawn_tool(delegate),
+ super::is_subagent_spawn_tool_with_registry(delegate, Some(&registry)),
"`{delegate}` is a synthesised delegation tool and must be \
stripped from sub-agent tool surfaces"
);
@@ -71,7 +77,7 @@ fn unprefixed_delegate_name_overrides_are_treated_as_spawn_tools() {
// Ordinary worker tools stay visible.
for plain in ["shell", "file_read", "web_fetch", "todo"] {
assert!(
- !is_subagent_spawn_tool(plain),
+ !super::is_subagent_spawn_tool_with_registry(plain, Some(&registry)),
"`{plain}` must not be classified as a spawn tool"
);
}
diff --git a/crates/openhuman-core/src/core/agent_cli/debug/prompt_size_tests.rs b/crates/openhuman-core/src/core/agent_cli/debug/prompt_size_tests.rs
index 178fe2e6dc..1f0ed13cd7 100644
--- a/crates/openhuman-core/src/core/agent_cli/debug/prompt_size_tests.rs
+++ b/crates/openhuman-core/src/core/agent_cli/debug/prompt_size_tests.rs
@@ -87,14 +87,24 @@ fn session_report_measures_the_visible_belt_not_the_registry() {
..crate::config::Config::default()
};
std::fs::create_dir_all(&config.workspace_dir).unwrap();
- let agent = crate::agent::OpenHumanSessionHost::from_config_for_agent(
+ let mut definition = crate::agent_registry::host_definition::AgentDefinitionRegistry::builtins_only()
+ .get("orchestrator")
+ .expect("built-in orchestrator")
+ .clone();
+ definition.id = "prompt_size_probe".to_string();
+ definition.tools = tinyagents_definition::ToolScope::Named(vec!["file_read".to_string()]);
+ let agent = crate::agent::OpenHumanSessionHost::from_config_with_definition(
&crate::core::runtime::DispatchCtx::ambient(),
&config,
- "critic",
+ &definition,
)
- .expect("critic session build");
+ .expect("test-owned prompt-size session build");
- let dumped = crate::core::agent_cli::debug::session_dump(&agent, "critic", String::new());
+ let dumped = crate::core::agent_cli::debug::session_dump(
+ &agent,
+ "prompt_size_probe",
+ String::new(),
+ );
let report = PromptSizeReport::from_dump(&dumped);
let mut visible: Vec<String> = agent
@@ -111,7 +121,7 @@ fn session_report_measures_the_visible_belt_not_the_registry() {
);
assert!(
report.tool_count < dumped.tool_names.len(),
- "critic's belt ({}) must be narrower than its registry ({}), or this test \
+ "the test-owned named belt ({}) must be narrower than its registry ({}), or this test \
cannot tell the two apart",
report.tool_count,
dumped.tool_names.len()
diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs b/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs
index baa0957f33..9fc8877118 100644
--- a/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs
@@ -413,24 +413,22 @@ fn agent_node_runtime_resolves_to_the_definitions_effective_iteration_cap() {
let config = resolver_test_config(&tmp);
assert_eq!(config.agent.max_tool_iterations, 10);
- crate::agent_registry::host_definition::AgentDefinitionRegistry::init_global(
- &config.workspace_dir,
- )
- .expect("agent registry init");
- let def = crate::agent_registry::host_definition::AgentDefinitionRegistry::global()
- .expect("registry initialised")
- .get("planner")
- .expect("planner definition registered")
+ let mut def = crate::agent_registry::host_definition::AgentDefinitionRegistry::builtins_only()
+ .get("orchestrator")
+ .expect("built-in orchestrator")
.clone();
+ def.id = "flow_iteration_cap_probe".to_string();
+ def.max_iterations = 50;
+ def.iteration_policy = tinyagents_definition::IterationPolicy::Extended;
let expected = def.effective_max_iterations();
assert_eq!(expected, 50);
- let agent = crate::agent::OpenHumanSessionHost::from_config_for_agent(
+ let agent = crate::agent::OpenHumanSessionHost::from_config_with_definition(
&crate::core::runtime::DispatchCtx::ambient(),
&config,
- "planner",
+ &def,
)
- .expect("build planner agent");
+ .expect("build test-owned extended-policy agent");
assert_eq!(agent.agent_config().max_tool_iterations, expected);
// And the timeout scaling this cap feeds into actually widens the
diff --git a/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rs b/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rs
index 9a664ac3c0..e26f509a17 100644
--- a/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rs
@@ -479,7 +479,7 @@ fn route_for_agent_ref_selects_harness_for_definitions_else_fallback() {
// A shipped harness definition → full-loop harness path.
assert_eq!(route_for_agent_ref("workflow_builder"), AgentRoute::Harness);
- assert_eq!(route_for_agent_ref("planner"), AgentRoute::Harness);
+ assert_eq!(route_for_agent_ref("flow_discovery"), AgentRoute::Harness);
// An id with no harness definition → the custom-registry completion fallback.
assert_eq!(
diff --git a/crates/openhuman-core/src/threads/ops/edit_tests.rs b/crates/openhuman-core/src/threads/ops/edit_tests.rs
index 0dd51e53ec..aca451c23a 100644
--- a/crates/openhuman-core/src/threads/ops/edit_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/edit_tests.rs
@@ -407,7 +407,7 @@ async fn edit_and_regenerate_use_the_threads_recorded_key_after_a_chat_agent_cha
);
DispatchCtx::new(CoreContext::for_test(DomainSet::full(), None).derive_with(overlay))
};
- let (before, after) = (ctx_with(None), ctx_with(Some("planner")));
+ let (before, after) = (ctx_with(None), ctx_with(Some("summarizer")));
let thread_id = "thread-flipped";
// The first session records its key and writes the transcript there.
diff --git a/crates/openhuman-core/src/threads/ops/transcript_tests.rs b/crates/openhuman-core/src/threads/ops/transcript_tests.rs
index 73e533bb17..3f433fd151 100644
--- a/crates/openhuman-core/src/threads/ops/transcript_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/transcript_tests.rs
@@ -206,7 +206,7 @@ async fn changing_the_chat_agent_does_not_strand_an_existing_threads_turns() {
let _ = crate::agent_registry::host_definition::AgentDefinitionRegistry::init_global_builtins();
let dir = tempfile::tempdir().unwrap();
let before = ctx_with_chat_agent(dir.path(), None, None);
- let after = ctx_with_chat_agent(dir.path(), None, Some("planner"));
+ let after = ctx_with_chat_agent(dir.path(), None, Some("summarizer"));
// The two configs derive different keys, or this proves nothing.
let rule_before = super::super::support::transcript_store(&before, THREAD)
diff --git a/crates/openhuman-core/src/web_chat/session_checkout_tests.rs b/crates/openhuman-core/src/web_chat/session_checkout_tests.rs
index a87bbe1a8b..ae6bcd8915 100644
--- a/crates/openhuman-core/src/web_chat/session_checkout_tests.rs
+++ b/crates/openhuman-core/src/web_chat/session_checkout_tests.rs
@@ -566,13 +566,13 @@ fn chat_agent_id_selects_the_web_chat_agent_and_defaults_to_the_orchestrator() {
"unset falls back to what the app runs"
);
- config.agent.chat_agent_id = Some("planner".to_string());
- assert_eq!(pick_target_agent_id(&config), "planner");
+ config.agent.chat_agent_id = Some("summarizer".to_string());
+ assert_eq!(pick_target_agent_id(&config), "summarizer");
// Padding is an operator typo in a hand-edited config.toml, not a request
// for an agent whose id has spaces in it.
- config.agent.chat_agent_id = Some(" planner ".to_string());
- assert_eq!(pick_target_agent_id(&config), "planner");
+ config.agent.chat_agent_id = Some(" summarizer ".to_string());
+ assert_eq!(pick_target_agent_id(&config), "summarizer");
// Blank is "unset", not "an agent named empty string": a turn routed at an
// id the registry cannot answer would fail chat outright.