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(subagent): scope subagent owner keys by workspace
Steven Enamakel9536ce6bb76e
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rsindex 85b44ba775..e6df1ffe9f 100644--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs@@ -60,6 +60,7 @@ pub fn cancel_driver_jobs_for_thread(continue;};let owner = crate::agent::tinyagents::tool_registration::subagent_owner_key(+ workspace_dir,&session.parent_session,Some(thread_id),);@@ -114,6 +115,7 @@ pub fn cancel_driver_job_for_session(return false;};let owner = crate::agent::tinyagents::tool_registration::subagent_owner_key(+ store.workspace_dir(),parent_session,parent_thread_id,);@@ -158,6 +160,7 @@ pub fn cancel_driver_job_for_observed_session(return false;};let owner = crate::agent::tinyagents::tool_registration::subagent_owner_key(+ store.workspace_dir(),parent_session,parent_thread_id,);diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_surface.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_surface.rsindex 9ca710e330..8b56f9774d 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_surface.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_surface.rs@@ -119,6 +119,7 @@ async fn steer_reusable_session(.ok_or_else(|| "reusable async subagent has no durable parent".to_owned())?;let thread_id = parent.thread_id().map(|id| id.as_str().to_owned());let owner = crate::agent::tinyagents::tool_registration::subagent_owner_key(+ &product_parent.workspace_dir,&product_parent.session_id,thread_id.as_deref(),);diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_tests.rsindex 97bcd4fdf9..064f5e0cdb 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_driver_tests.rs@@ -213,6 +213,7 @@ async fn force_fresh_cancels_old_driver_before_creating_a_new_session() {}).with_owner_scope(Arc::new({let owner = crate::agent::tinyagents::tool_registration::subagent_owner_key(+ &workspace,"force-fresh-parent-session",Some("force-fresh-parent-thread"),);diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rsindex c09a531e02..e0b77d89ac 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs@@ -469,6 +469,12 @@ async fn invoke_driver_tool_with_request(.unwrap_or_default();let thread_id = parent.thread_id().map(|id| id.as_str().to_owned());let owner = crate::agent::tinyagents::tool_registration::subagent_owner_key(+ &parent+ .data+ .parent+ .as_ref()+ .map(|context| context.workspace_dir.as_path())+ .unwrap_or_else(|| std::path::Path::new("")),&parent_session,thread_id.as_deref(),);diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_driver_bridge_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_driver_bridge_tests.rsindex 0554357f2b..f0e1ea7529 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_driver_bridge_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_driver_bridge_tests.rs@@ -160,6 +160,7 @@ async fn closing_a_durable_driver_session_cancels_only_its_registered_child() {).with_jobs(jobs.clone());let owner = crate::agent::tinyagents::tool_registration::subagent_owner_key(+ &workspace,"test-session",Some("close-driver-thread"),);diff --git a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rsindex e61a64a98a..8a9cba32f5 100644--- a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs+++ b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs@@ -72,13 +72,19 @@ impl ToolDispatch<(), OpenHumanRunContext> for LiveToolContextDispatch {}}-/// Collision-free stable scope for controls over a host-owned parent session-/// and optional chat thread. JSON tuple encoding distinguishes absent thread-/// from the literal `"no-thread"` and handles delimiters in either value.-pub(crate) fn subagent_owner_key(parent_session: &str, thread_id: Option<&str>) -> String {+/// Collision-free stable scope for controls over a host-owned parent session,+/// workspace, and optional chat thread. JSON tuple encoding distinguishes+/// absent thread from the literal `"no-thread"` and handles delimiters in any+/// value.+pub(crate) fn subagent_owner_key(+ workspace: &std::path::Path,+ parent_session: &str,+ thread_id: Option<&str>,+) -> String {format!("openhuman-subagent-owner:{}",- serde_json::to_string(&(parent_session, thread_id)).unwrap_or_else(|_| "null".into())+ serde_json::to_string(&(workspace, parent_session, thread_id))+ .unwrap_or_else(|_| "null".into()))}@@ -377,7 +383,11 @@ fn subagent_control_dispatches().with_jobs(jobs.clone()),);- let owner = subagent_owner_key(&parent.session_id, run_context.thread_id.as_deref());+ let owner = subagent_owner_key(+ &parent.workspace_dir,+ &parent.session_id,+ run_context.thread_id.as_deref(),+ );let parent_session = parent.session_id.clone();let owner_scope: Arc<dyn Fn(u64) -> String + Send + Sync> = Arc::new(move |_| owner.clone());