Skip to content

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

test(orchestration): cover late terminal completions during thread deletion

Steven Enamakel723cfcf8e31a
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 68f5204b28..16fa5ac6fb 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
@@ -529,6 +529,30 @@ async fn deleting_parent_thread_cancels_driver_child_before_discarding_completio
background_completions::pending_for(&workspace, thread_id).is_empty(),
"queued child completions are discarded after cancellation"
);
+ background_completions::record_outcome(
+ &dispatch,
+ &workspace,
+ parent_session,
+ task_id.clone(),
+ "task_manager_agent",
+ "late terminal child completion",
+ Some(thread_id.into()),
+ BackgroundAgentOutcome::Completed,
+ )
+ .await;
+ crate::threads::ops::thread_delete(
+ &dispatch,
+ crate::threads::DeleteConversationThreadRequest {
+ thread_id: thread_id.into(),
+ deleted_at: "2026-01-01T00:02:00Z".into(),
+ },
+ )
+ .await
+ .expect("a retained terminal owner does not block deletion cleanup");
+ assert!(
+ background_completions::pending_for(&workspace, thread_id).is_empty(),
+ "terminal driver owners do not prevent queued completions from being discarded"
+ );
release_on_cancel
.await
.expect("cancellation-aware child release task completes");