Skip to content

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

fix(orchestration): register parent thread and task workspace on subagent spawn

Steven Enamakel84712702e8b7
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions.rs b/crates/openhuman-core/src/agent/orchestration/background_completions.rs
index 080e43bd62..eac889f2b1 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions.rs
@@ -40,7 +40,8 @@ pub(super) use store_adapter::{
};
use thread_index::{key, note_thread_workspace};
pub(crate) use thread_index::{
- note_session_thread, router_for_thread, thread_for_session, workspace_for_thread,
+ note_session_thread, note_thread_workspace, router_for_thread, thread_for_session,
+ workspace_for_thread,
};
use std::path::{Path, PathBuf};
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs
index 4606d255b4..77561228db 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs
@@ -593,6 +593,30 @@ impl SpawnSubagentTool {
task_key
);
+ if let Some(thread_id) = parent_thread_id.as_deref() {
+ crate::agent::orchestration::background_completions::note_thread_workspace(
+ &dispatch,
+ thread_id,
+ &parent.workspace_dir,
+ );
+ crate::agent::orchestration::background_completions::note_session_thread(
+ &dispatch,
+ &parent_session,
+ thread_id,
+ );
+ }
+ let task_workspace = workspace_descriptor
+ .clone()
+ .unwrap_or_else(|| tinytools::WorkspaceDescriptor::new(parent.workspace_dir.clone()));
+ crate::agent::orchestration::completion_owners::note_driver_task(
+ &dispatch,
+ &task_id,
+ parent.workspace_dir.clone(),
+ task_workspace,
+ parent_session.clone(),
+ parent_thread_id.clone(),
+ );
+
crate::agent::orchestration::subagent_events::publish_subagent_spawned(
parent_session.clone(),
definition.id.clone(),