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): detect finished subagents from durable session status
Steven Enamakelac4ce3274c39
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rsindex 1abc61bd07..6e90288f07 100644--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs@@ -102,11 +102,25 @@ pub(crate) async fn cancel_by_task_with_workspace_reason(session.subagent_session_id.clone(),).map_err(|error| format!("failed to load parent epoch: {error}"))?;- let already_finished = job.as_ref().and_then(|job| match job.status {- SubAgentJobStatus::Completed => Some(FinishedOutcome::Completed),- SubAgentJobStatus::Failed | SubAgentJobStatus::Incomplete => Some(FinishedOutcome::Failed),- _ => None,- });+ let already_finished = job+ .as_ref()+ .and_then(|job| match job.status {+ SubAgentJobStatus::Completed => Some(FinishedOutcome::Completed),+ SubAgentJobStatus::Failed | SubAgentJobStatus::Incomplete => {+ Some(FinishedOutcome::Failed)+ }+ _ => None,+ })+ .or_else(|| match session.status {+ tinyagents_orchestration::subagent::DurableSubagentStatus::Idle => {+ Some(FinishedOutcome::Completed)+ }+ tinyagents_orchestration::subagent::DurableSubagentStatus::Failed+ | tinyagents_orchestration::subagent::DurableSubagentStatus::Closed => {+ Some(FinishedOutcome::Failed)+ }+ _ => None,+ });let was_paused =session.status == tinyagents_orchestration::subagent::DurableSubagentStatus::AwaitingUser;if already_finished.is_none() {diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_paused_cancel_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_paused_cancel_tests.rsindex 851fb6218b..6941271c75 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_paused_cancel_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_paused_cancel_tests.rs@@ -143,6 +143,14 @@ async fn cancelling_a_paused_driver_settles_once_with_its_reason() {Some("paused-cancel-rpc-thread"));assert!(before_row.lifecycle_key.is_some());+ assert!(+ crate::agent::orchestration::completion_owners::driver_task_owner(+ &live.data.dispatch_ctx(),+ &task_id,+ )+ .is_some(),+ "spawn records the owner scope needed by the cancel RPC"+ );assert_eq!(live.data.dispatch_ctx()diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_profile_cancel_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_profile_cancel_tests.rsindex b508bf58e1..59d3419951 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_profile_cancel_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_profile_cancel_tests.rs@@ -175,6 +175,11 @@ async fn profile_scope_cannot_cancel_another_profiles_driver_child() {.get(alice_job_id.as_str()).expect("real child is registered in Alice's scoped driver registry");assert_eq!(alice_job.status, SubAgentJobStatus::Running);+ assert!(+ crate::agent::orchestration::completion_owners::driver_task_owner(&alice_ctx, &task_id,)+ .is_some(),+ "spawn records Alice's exact task owner scope"+ );let bob_ctx = DispatchCtx::new(Arc::clone(&bob));let bob_job_registry = crate::core::runtime::slot_for::<