Skip to content

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

fix: validate delegation inputs before runtime checks

Steven Enamakele8cab6c80a85
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs
index 4fde0874e7..1ad981cccb 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs
@@ -11,11 +11,6 @@ impl SpawnAsyncSubagentTool {
>,
>,
) -> anyhow::Result<ToolResult> {
- let Some(detached_parent) = detached_parent else {
- return Ok(ToolResult::error(
- "spawn_async_subagent requires a live harness run context.",
- ));
- };
let agent_id = args
.get("agent_id")
.and_then(|v| v.as_str())
@@ -63,6 +58,11 @@ impl SpawnAsyncSubagentTool {
"spawn_async_subagent: `prompt` is required",
));
}
+ let Some(detached_parent) = detached_parent else {
+ return Ok(ToolResult::error(
+ "spawn_async_subagent requires a live harness run context.",
+ ));
+ };
let parent = match run_context.parent.clone() {
Some(parent) => parent,
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs
index 84dddc6e84..be386d2b6d 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs
@@ -88,11 +88,6 @@ pub(crate) async fn execute_spawn_parallel_agents(
run_context: crate::agent::tinyagents::host::OpenHumanRunContext,
live_parent: Option<&RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>>,
) -> anyhow::Result<ToolResult> {
- let Some(live_parent) = live_parent else {
- return Ok(ToolResult::error(
- "spawn_parallel_agents requires a live harness run context.",
- ));
- };
tracing::debug!("[spawn_parallel_agents] execute entry");
let tasks = match parse_parallel_agent_tasks(&args) {
Ok(tasks) => tasks,
@@ -104,6 +99,11 @@ pub(crate) async fn execute_spawn_parallel_agents(
return Ok(ToolResult::error(message));
}
};
+ let Some(live_parent) = live_parent else {
+ return Ok(ToolResult::error(
+ "spawn_parallel_agents requires a live harness run context.",
+ ));
+ };
let outcome = run_spawn_parallel_tasks_with_cancellation_and_workspace(
tasks,
cancellation,