Skip to content

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

chore: files changed crates/openhuman-core/src/agent/subagent_host/ops/runner.rs,crates/openhuman-co

Steven Enamakelfb1d407b2bff
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
index 052da01324..5536141b9a 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
@@ -580,20 +580,6 @@ async fn run_typed_mode(
.iter()
.map(|&i| parent.all_tools[i].name().to_string())
.collect();
- #[cfg(test)]
- if active_child_depth > 0 {
- eprintln!(
- "NESTED_SPAWN_ADMISSION_TRACE agent={} active_child_depth={} max_depth={} depth_room={} explicit_spawn={} parent_ceiling_unrestricted={} parent_ceiling_contains_spawn={} final_allowlist_contains_spawn={}",
- definition.id,
- active_child_depth,
- max_depth,
- nested_spawn_depth_available,
- explicitly_declares_nested_spawn("spawn_subagent"),
- parent.subagent_tool_ceiling_names.is_empty(),
- parent.subagent_tool_ceiling_names.contains("spawn_subagent"),
- allowed_names.contains("spawn_subagent"),
- );
- }
let filtered_specs = dedup_visible_tool_specs(filtered_specs);
tracing::debug!(
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs
index 739494b20a..450ff544e7 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs
@@ -199,6 +199,17 @@ fn detached_children_reset_turn_accounting_and_cancellation() {
);
assert_eq!(root.child().headless_descendant_owner.as_deref(), Some("root-owner"));
assert!(detached.headless_descendant_owner.is_none());
+ let workspace = std::path::Path::new("/workspace");
+ assert_eq!(
+ root.child().subagent_owner_scope(workspace, "session", Some("worker-thread")),
+ "root-owner",
+ "headless descendants retain the root lease's owner across native thread ids"
+ );
+ assert_ne!(
+ detached.subagent_owner_scope(workspace, "session", Some("worker-thread")),
+ "root-owner",
+ "detached chat work keeps its own owner scope"
+ );
assert!(detached.dispatch.is_none());
root.cancellation.cancel();
assert!(!detached.cancellation.is_cancelled());
diff --git a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
index f760fe8129..4aac629a91 100644
--- a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
@@ -237,16 +237,6 @@ pub(crate) fn turn_admission(
has_thread: bool,
nested_spawn_depth: Option<NestedSpawnDepth>,
) -> ToolAdmission {
- #[cfg(test)]
- if nested_spawn_depth.is_some() {
- eprintln!(
- "NESTED_SPAWN_TOOL_ADMISSION_TRACE depth_grant={nested_spawn_depth:?} allowlist_contains_spawn={} spawn_candidates={:?}",
- allowed
- .as_ref()
- .is_none_or(|names| names.contains("spawn_subagent")),
- candidate_spawn_tools(tool_sets),
- );
- }
ToolAdmission {
allowed: allowed.clone(),
// A sub-agent scope on the turn forces this on in the driver.
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs b/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs
index 044f77fff2..8158f3c9ff 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_plan.rs
@@ -120,22 +120,6 @@ impl TurnPlanner<(), OpenHumanRunContext> for OpenHumanTurnPlanner {
) -> Result<TurnPlan<(), OpenHumanRunContext>, RuntimeError> {
let mut plan = TurnPlan::new(self.models.clone());
plan.policy = self.policy.clone();
- #[cfg(test)]
- if request.run_context.config.depth() > 0 {
- eprintln!(
- "NESTED_SPAWN_RUN_CONFIG_TRACE depth={} max_depth={} host_spawn_depth={} allowlist_contains_spawn={} grant={:?}",
- request.run_context.config.depth(),
- request.run_context.config.max_depth(),
- request.run_context.data.spawn_depth,
- self.allowed
- .as_ref()
- .is_none_or(|allowed| allowed.contains("spawn_subagent")),
- NestedSpawnDepth::try_new(
- request.run_context.config.depth(),
- request.run_context.config.max_depth(),
- ),
- );
- }
plan.tools = host_tool_set_builder_for_turn(
&self.tool_sets,
&self.allowed,
diff --git a/crates/openhuman-core/src/flows/caps_host/agent_tests.rs b/crates/openhuman-core/src/flows/caps_host/agent_tests.rs
index 5969be5729..b3c9ccef82 100644
--- a/crates/openhuman-core/src/flows/caps_host/agent_tests.rs
+++ b/crates/openhuman-core/src/flows/caps_host/agent_tests.rs
@@ -285,34 +285,6 @@ async fn headless_flow_agent_includes_nested_grandchild_result() {
} if tool_name == "spawn_subagent"
)
});
- let nested_spawn_outcomes = worker_events
- .iter()
- .filter_map(|observation| match &observation.event {
- tinyagents_harness::events::AgentEvent::ToolCompleted {
- tool_name,
- error,
- ..
- } if tool_name == "spawn_subagent" => Some(error.clone()),
- tinyagents_harness::events::AgentEvent::UnknownToolCall {
- requested_name,
- recovery,
- ..
- } if requested_name == "spawn_subagent" => Some(Some(recovery.clone())),
- _ => None,
- })
- .collect::<Vec<_>>();
- eprintln!(
- "NESTED_FLOW_POLICY_DIAGNOSTIC worker_calls={} schema={:?} nested_spawn_calls={} worker_jobs={:?} grandchild_jobs={:?} spawn_events={:?}",
- model.child_calls.load(std::sync::atomic::Ordering::SeqCst),
- model.child_schema_names.lock().unwrap(),
- model.nested_spawn_calls.load(std::sync::atomic::Ordering::SeqCst),
- child_runs,
- grandchild_jobs
- .iter()
- .map(|job| (&job.status, job.output.as_deref().is_some_and(|s| s.contains("headless-flow-grandchild-result"))))
- .collect::<Vec<_>>(),
- nested_spawn_outcomes,
- );
let grandchild_run_id = grandchild_jobs
.first()
.and_then(|job| job.subagent_run_id.as_deref())
@@ -332,13 +304,6 @@ async fn headless_flow_agent_includes_nested_grandchild_result() {
)
});
let grandchild_output = grandchild_jobs[0].output.as_deref().unwrap_or_default();
- eprintln!(
- "NESTED_FLOW_TERMINAL_DIAGNOSTIC returned_before_child={returned_before_child} status={:?} error={:?} events={:?}",
- grandchild_jobs[0].status,
- grandchild_jobs[0].error,
- grandchild_events.iter().map(|o| &o.event).collect::<Vec<_>>(),
- );
-
assert_eq!(
model.spawn_calls.load(std::sync::atomic::Ordering::SeqCst),
1,
@@ -349,6 +314,10 @@ async fn headless_flow_agent_includes_nested_grandchild_result() {
2,
"the worker must run, spawn its grandchild, and complete through the real dispatch"
);
+ assert!(
+ model.child_schema_names.lock().unwrap()[0].iter().any(|name| name == "spawn_subagent"),
+ "the worker's explicitly declared nested-spawn capability must reach its model schema"
+ );
assert_eq!(
model
.nested_spawn_calls