Skip to content

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

fix(orchestration): continue cancelling remaining jobs after driver thread deletion failure

Steven Enamakel26c31228d49f
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs
index 39f3fc76cf..67f3ca35c8 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs
@@ -346,7 +346,6 @@ pub(crate) async fn cancel_for_thread(
log::warn!(
"[running_subagents] driver thread deletion cancellation failed: {error}"
);
- continue;
}
}
if let Err(error) = jobs.wait_owned(job.id.as_str(), &owner_key).await {
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.rs
index 69753395ec..bc340b8000 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
@@ -478,17 +478,6 @@ async fn deleting_parent_thread_cancels_driver_child_before_discarding_completio
scoped_jobs.iter().any(|scoped| scoped.id == job.id),
"the driver's own scope query sees the job selected by the owner index"
);
- let release_on_cancel = {
- let release = release.clone();
- tokio::spawn(async move {
- // Give thread deletion time to request cancellation and enter its
- // settlement wait. The running snapshot stays `Running` until the
- // provider unwinds, so the cancellation request itself is not
- // observable through the public job snapshot.
- tokio::time::sleep(std::time::Duration::from_millis(100)).await;
- release.notify_one();
- })
- };
background_completions::record_outcome(
&dispatch,
&workspace,
@@ -505,6 +494,17 @@ async fn deleting_parent_thread_cancels_driver_child_before_discarding_completio
1,
"the deletion starts with a queued child completion"
);
+ let release_on_cancel = {
+ let release = release.clone();
+ tokio::spawn(async move {
+ // Give thread deletion time to request cancellation and enter its
+ // settlement wait. The running snapshot stays `Running` until the
+ // provider unwinds, so the cancellation request itself is not
+ // observable through the public job snapshot.
+ tokio::time::sleep(std::time::Duration::from_millis(100)).await;
+ release.notify_one();
+ })
+ };
tokio::time::timeout(
std::time::Duration::from_secs(6),