Skip to content

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

fix(orchestration): prefer live workspace descriptor for subagent roster

Steven Enamakeld0bdacd5dcc5
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents/roster.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents/roster.rs
index 76a7f5c091..35749913c2 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/roster.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/roster.rs
@@ -83,16 +83,19 @@ fn workspace_scope_for_thread(
ctx: &crate::core::runtime::DispatchCtx,
workspace_dir: &std::path::Path,
thread_id: &str,
+ workspace: Option<&tinytools::WorkspaceDescriptor>,
) -> tinytools::WorkspaceDescriptor {
- crate::agent::orchestration::completion_owners::driver_tasks_for_thread(
- ctx,
- workspace_dir,
- thread_id,
- )
- .into_iter()
- .next()
- .map(|(_, owner)| owner.workspace)
- .unwrap_or_else(|| tinytools::WorkspaceDescriptor::new(workspace_dir))
+ workspace.cloned().unwrap_or_else(|| {
+ crate::agent::orchestration::completion_owners::driver_tasks_for_thread(
+ ctx,
+ workspace_dir,
+ thread_id,
+ )
+ .into_iter()
+ .next()
+ .map(|(_, owner)| owner.workspace)
+ .unwrap_or_else(|| tinytools::WorkspaceDescriptor::new(workspace_dir))
+ })
}
/// Most-recent durable sessions surfaced in the roster when they are not in
@@ -117,6 +120,7 @@ pub(crate) async fn active_subagents_context_block(
ctx: &crate::core::runtime::DispatchCtx,
parent_session: &str,
workspace_dir: &std::path::Path,
+ workspace: Option<&tinytools::WorkspaceDescriptor>,
) -> Option<String> {
admit_workspace(ctx, workspace_dir).ok()?;
let Some(thread_id) = crate::agent::orchestration::background_completions::thread_for_session(
@@ -183,7 +187,7 @@ pub(crate) async fn active_subagents_context_block(
Some(&thread_id),
);
let scope = tinyagents_orchestration::subagent::ParentJobScope::new(
- workspace_scope_for_thread(ctx, workspace_dir, &thread_id),
+ workspace_scope_for_thread(ctx, workspace_dir, &thread_id, workspace),
thread_id,
);
let block = tinyagents_orchestration::subagent::format_parent_roster_for_owner(
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs
index e1fd5e47b0..a42b34c7a0 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs
@@ -415,12 +415,16 @@ async fn spawn_subagent_reuses_idle_task_key_with_the_saved_history() {
parent.session_id = "idle-reuse-e2e".into();
let (progress_tx, mut progress_rx) = tokio::sync::mpsc::channel(64);
parent.on_progress = Some(progress_tx);
- let (live, _core) = core_backed_live_parent(
+ let (mut live, _core) = core_backed_live_parent(
workspace.path(),
parent,
"idle-reuse-e2e",
"idle-reuse-e2e-thread",
);
+ let workspace_descriptor = tinytools::WorkspaceDescriptor::new(workspace.path())
+ .with_trusted_root(workspace.path().join("shared-worktree"))
+ .with_policy_id("idle-roster-policy");
+ live.workspace = Some(workspace_descriptor.clone());
assert!(live.data.dispatch_ctx().resolved().is_some());
let tool = SpawnSubagentTool::new();
let first = tool
@@ -461,6 +465,7 @@ async fn spawn_subagent_reuses_idle_task_key_with_the_saved_history() {
&live.data.dispatch_ctx(),
"idle-reuse-e2e",
workspace.path(),
+ Some(&workspace_descriptor),
)
.await
.expect("driver-backed child appears in the parent roster");
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/prelude.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/prelude.rs
index 360d0012a1..c31ca2a8db 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session/prelude.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/prelude.rs
@@ -286,6 +286,7 @@ impl OpenHumanTurnPrelude {
&self.dispatch_ctx(),
&self.event_session_id,
&self.workspace_dir,
+ self.workspace_descriptor.as_ref(),
)
.await
{