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
feat(agent): notify parent session when background subagent completes
Steven Enamakeldc2fa6cd56d5
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions.rs b/crates/openhuman-core/src/agent/orchestration/background_completions.rsindex d7714a5f7d..6e3f17c1d4 100644--- a/crates/openhuman-core/src/agent/orchestration/background_completions.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_completions.rs@@ -308,6 +308,76 @@ pub(crate) async fn record_awaiting_input(.await;}+/// Where one detached child's completion lands: its workspace (which router),+/// the parent session (the idle gate) and the parent chat thread (the router's+/// parent key). Built once at spawn so every terminal path records the same way.+#[derive(Clone, Debug)]+pub(crate) struct CompletionTarget {+ workspace_dir: PathBuf,+ parent_session: String,+ parent_thread_id: Option<String>,+}++impl CompletionTarget {+ pub(crate) fn new(+ workspace_dir: PathBuf,+ parent_session: String,+ parent_thread_id: Option<String>,+ ) -> Self {+ Self {+ workspace_dir,+ parent_session,+ parent_thread_id,+ }+ }++ /// Queue a finished result. See [`record_completion`].+ pub(crate) async fn completed(&self, task_id: &str, agent_id: &str, summary: String) {+ record_completion(+ &self.workspace_dir,+ &self.parent_session,+ task_id,+ agent_id,+ summary,+ self.parent_thread_id.clone(),+ )+ .await;+ }++ /// Queue a failure. See [`record_failure`].+ pub(crate) async fn failed(&self, task_id: &str, agent_id: &str, error: &str) {+ record_failure(+ &self.workspace_dir,+ &self.parent_session,+ task_id,+ agent_id,+ error,+ self.parent_thread_id.clone(),+ )+ .await;+ }++ /// Queue an awaiting-input pause. See [`record_awaiting_input`].+ pub(crate) async fn awaiting_input(+ &self,+ task_id: &str,+ agent_id: &str,+ question: &str,+ checkpointed: bool,+ ) {+ record_awaiting_input(+ &self.workspace_dir,+ &self.parent_session,+ task_id,+ agent_id,+ question,+ checkpointed,+ self.parent_thread_id.clone(),+ )+ .await;+ }+}+/// Undelivered completions for `thread_id`, oldest first (read-only; includes/// records an in-flight delivery currently holds).pub(crate) fn pending_for(workspace_dir: &Path, thread_id: &str) -> Vec<CompletionRecord> {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 4b89968ae2..9085be6652 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@@ -381,6 +381,11 @@ impl SpawnAsyncSubagentTool {let background_agent_id = definition.id.clone();let background_task_id = task_id.clone();let background_parent_session = parent_session.clone();+ let completion_target = crate::agent::orchestration::background_completions::CompletionTarget::new(+ parent.workspace_dir.clone(),+ parent_session.clone(),+ parent_thread_id.clone(),+ );let background_worker_thread_id = worker_thread_id.clone();let background_store = store.clone();let background_subagent_session_id = durable_session.subagent_session_id.clone();