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
fix(orchestration): refuse async subagent spawn when parent thread is stopped
Steven Enamakelc59359e77fe2
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.rsindex 33dbd58424..a94e8ba908 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@@ -255,6 +255,18 @@ impl SpawnAsyncSubagentTool {}let task_id = format!("sub-{}", uuid::Uuid::new_v4());+ if let Some(thread_id) = parent_thread_id.as_deref() {+ if crate::agent::orchestration::background_completions::mark_stopped_task_if_thread_stopped(+ &dispatch,+ &parent.workspace_dir,+ thread_id,+ &task_id,+ ) {+ return Ok(ToolResult::error(+ "spawn_async_subagent: parent thread is stopped or deleted",+ ));+ }+ }let worker_thread_id = reusable.as_ref().and_then(|session| session.worker_thread_id.clone())diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rsindex 4e908f5373..5dbf8f2d5f 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs@@ -414,6 +414,10 @@ async fn stopped_async_spawn_is_refused_before_progress_or_session_effects() {assert!(result.output().contains("stopped or deleted"), "{}", result.output());assert!(provider.seen.lock().is_empty(), "refusal must not dispatch the model");assert!(progress_rx.try_recv().is_err(), "refusal must not publish spawn progress");+ let jobs = crate::core::runtime::slot_for::<+ tinyagents_orchestration::subagent::SubAgentJobRegistry,+ >(&dispatch);+ assert!(jobs.list().is_empty(), "refusal must not register a shared job");assert!(crate::agent::orchestration::subagent_sessions::SubagentSessionStore::new(workspace.clone()