Skip to content

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

fix(orchestration): commit thread deletion in parent lifecycle

Steven Enamakel3ed8da45b38d
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions/parent_lifecycle.rs b/crates/openhuman-core/src/agent/orchestration/background_completions/parent_lifecycle.rs
index a87e0f09c0..6773149e85 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions/parent_lifecycle.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions/parent_lifecycle.rs
@@ -67,6 +67,11 @@ pub(crate) fn delete_parent_for_thread(
.router
.delete_parent(thread_id)
.map_err(|error| format!("failed to persist deleted-parent marker: {error}"))?;
+ crate::agent::orchestration::completion_owners::commit_thread_deletion(
+ ctx,
+ workspace_dir,
+ thread_id,
+ )?;
log::debug!(
"[background_completions] delete_parent_for_thread thread_id={thread_id} removed={removed}"
);
diff --git a/crates/openhuman-core/src/agent/orchestration/completion_owners.rs b/crates/openhuman-core/src/agent/orchestration/completion_owners.rs
index 24638e332d..3e1e91b583 100644
--- a/crates/openhuman-core/src/agent/orchestration/completion_owners.rs
+++ b/crates/openhuman-core/src/agent/orchestration/completion_owners.rs
@@ -184,11 +184,10 @@ pub(crate) fn begin_thread_deletion(
.map_err(|error| format!("cannot resolve profile for thread deletion: {error}"))?
.profile;
let mut st = owners();
- begin_thread_deletion_in(&mut st, driver_thread_scope(
- profile,
- workspace_dir.to_path_buf(),
- thread_id.to_owned(),
- ));
+ begin_thread_deletion_in(
+ &mut st,
+ driver_thread_scope(profile, workspace_dir.to_path_buf(), thread_id.to_owned()),
+ );
Ok(())
}
@@ -203,11 +202,10 @@ pub(crate) fn commit_thread_deletion(
.map_err(|error| format!("cannot resolve profile for thread deletion: {error}"))?
.profile;
let mut st = owners();
- commit_thread_deletion_in(&mut st, driver_thread_scope(
- profile,
- workspace_dir.to_path_buf(),
- thread_id.to_owned(),
- ));
+ commit_thread_deletion_in(
+ &mut st,
+ driver_thread_scope(profile, workspace_dir.to_path_buf(), thread_id.to_owned()),
+ );
Ok(())
}
@@ -219,11 +217,10 @@ pub(crate) fn release_thread_deletion(
) {
let profile = ctx.tenant().ok().and_then(|tenant| tenant.profile);
let mut st = owners();
- release_thread_deletion_in(&mut st, &driver_thread_scope(
- profile,
- workspace_dir.to_path_buf(),
- thread_id.to_owned(),
- ));
+ release_thread_deletion_in(
+ &mut st,
+ &driver_thread_scope(profile, workspace_dir.to_path_buf(), thread_id.to_owned()),
+ );
}
/// Move a settled task out of the non-evictable live-owner set while retaining
diff --git a/crates/openhuman-core/src/agent/orchestration/completion_owners_tests.rs b/crates/openhuman-core/src/agent/orchestration/completion_owners_tests.rs
index e0c2596c41..914caceedd 100644
--- a/crates/openhuman-core/src/agent/orchestration/completion_owners_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/completion_owners_tests.rs
@@ -55,11 +55,14 @@ fn deleting_thread_refuses_late_owner_registration_but_keeps_prior_owner() {
ACTIVE_DRIVER_TASKS_CAP,
)
.expect("register live child before deletion starts");
- st.deleting_threads.insert(driver_thread_scope(
- existing.profile.clone(),
- existing.workspace_dir.clone(),
- existing.parent_thread_id.clone().expect("thread owner"),
- ));
+ begin_thread_deletion_in(
+ &mut st,
+ driver_thread_scope(
+ existing.profile.clone(),
+ existing.workspace_dir.clone(),
+ existing.parent_thread_id.clone().expect("thread owner"),
+ ),
+ );
let late = owner("late");
let result = remember_active_driver_task(&mut st, "late".into(), late, ACTIVE_DRIVER_TASKS_CAP);