Skip to content

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

test(orchestration): document late cancel semantics and expose delivery slot key

Steven Enamakelce6b11aaa44d
diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions_release_tests.rs b/crates/openhuman-core/src/agent/orchestration/background_completions_release_tests.rs
index 4bb91cf551..218136c171 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_completions_release_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_completions_release_tests.rs
@@ -12,6 +12,13 @@ fn workspace() -> TestWorkspace {
TestWorkspace::new()
}
+fn pending_ids(ws: &Path, thread: &str) -> Vec<String> {
+ pending_for(ws, thread)
+ .into_iter()
+ .map(|r| r.task_id)
+ .collect()
+}
+
#[tokio::test]
async fn release_all_closes_every_router_and_the_log_stays_replayable() {
let _guard = crate::config::TEST_ENV_LOCK.lock().await;
diff --git a/crates/openhuman-core/src/agent/orchestration/background_delivery/slot.rs b/crates/openhuman-core/src/agent/orchestration/background_delivery/slot.rs
index d6c68ac059..725ded3aea 100644
--- a/crates/openhuman-core/src/agent/orchestration/background_delivery/slot.rs
+++ b/crates/openhuman-core/src/agent/orchestration/background_delivery/slot.rs
@@ -21,7 +21,7 @@ pub(super) fn delivering() -> &'static Mutex<HashSet<String>> {
/// so a settled batch is untouched and an abandoned one is claimable again.
pub(super) struct DeliverySlot {
/// [`tenant::profile_key`] of the thread id.
- key: String,
+ pub(super) key: String,
router: Arc<CompletionRouter>,
held: Vec<String>,
}
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents_cancel_tests.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents_cancel_tests.rs
index 4e928bd029..e8da5664db 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents_cancel_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents_cancel_tests.rs
@@ -2,6 +2,10 @@
use super::*;
+/// A finished run stays registered until the terminal sweep, so a late
+/// "Cancel" still finds it. It must come back flagged, so the RPC does not
+/// rewrite a completed session as "cancelled by user" — while a run paused on
+/// the user is still a real cancel.
#[tokio::test]
async fn cancel_by_task_flags_a_run_that_already_finished() {
let _guard = test_guard_async().await;
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents_tests.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents_tests.rs
index 228f353ca9..26f2705bf9 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents_tests.rs
@@ -625,8 +625,3 @@ async fn cancel_by_task_returns_metadata_and_removes_entry() {
// Unknown ids are simply None.
assert!(cancel_by_task(&cx(), "never-existed").is_none());
}
-
-/// A finished run stays registered until the terminal sweep, so a late
-/// "Cancel" still finds it. It must come back flagged, so the RPC does not
-/// rewrite a completed session as "cancelled by user" — while a run paused on
-/// the user is still a real cancel.