Skip to content

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

test(orchestration): align e2e cancellation tests with driver session lookup

Steven Enamakel237fbcbdb69f
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs
index fceff83c8f..32d4878496 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_continuation_tests.rs
@@ -532,7 +532,7 @@ async fn wait_completed(
Some(crate::progress::AgentProgress::SubagentCompleted { agent_id, .. })
if agent_id == "task_manager_agent" =>
{
- break
+ break;
}
Some(crate::progress::AgentProgress::SubagentFailed { error, .. }) => {
panic!("child failed before completion: {error}")
@@ -592,7 +592,7 @@ impl tinyinference_llm::model::ChatModel<()> for TwoTurnModel {
call => {
return Err(tinyinference_llm::Error::Model(format!(
"unexpected call {call}"
- )))
+ )));
}
};
Ok(tinyinference_llm::model::ModelResponse::assistant(answer))
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 05f5a27496..c673a1a915 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
@@ -555,9 +555,7 @@ async fn deleted_thread_marker_survives_router_restart_and_refuses_async_spawn()
#[tokio::test]
async fn detached_registration_failure_finishes_the_announced_product_card() {
- use crate::agent::orchestration::subagent_sessions::{
- DurableSubagentStatus,
- };
+ use crate::agent::orchestration::subagent_sessions::DurableSubagentStatus;
use crate::agent::tinyagents::host::OpenHumanRunContext;
use crate::core::runtime::{ContextOverlay, CoreContext, DomainSet};
use crate::tools::toolpacks::ToolGroups;
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.rs
index 4649f68bd1..851fb6218b 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
@@ -5,9 +5,7 @@ async fn cancelling_a_paused_driver_settles_once_with_its_reason() {
use crate::agent::orchestration::background_completions::{
forget_workspace_for_test, pending_for_ctx,
};
- use crate::agent::orchestration::subagent_sessions::{
- DurableSubagentStatus,
- };
+ use crate::agent::orchestration::subagent_sessions::DurableSubagentStatus;
use crate::agent::orchestration::tools::SpawnSubagentTool;
use tinyagents_harness_tools::subagents::SubAgentJobRegistry;
use tinyagents_orchestration::subagent::SubAgentJobStatus;
@@ -133,11 +131,11 @@ async fn cancelling_a_paused_driver_settles_once_with_its_reason() {
&parent_session,
Some("paused-cancel-rpc-thread"),
)
- .await
- .expect("paused driver session list")
- .into_iter()
- .find(|row| row.current_task_id.as_deref() == Some(task_id.as_str()))
- .expect("actual paused durable session remains available");
+ .await
+ .expect("paused driver session list")
+ .into_iter()
+ .find(|row| row.current_task_id.as_deref() == Some(task_id.as_str()))
+ .expect("actual paused durable session remains available");
assert_eq!(before_row.status, DurableSubagentStatus::AwaitingUser);
assert_eq!(before_row.parent_session, parent_session);
assert_eq!(
@@ -182,17 +180,23 @@ async fn cancelling_a_paused_driver_settles_once_with_its_reason() {
.status,
SubAgentJobStatus::Cancelled
));
- let row = SubagentSessionStore::new(workspace.path().to_path_buf())
- .load()
- .expect("durable session")
- .into_iter()
- .find(|row| row.current_task_id.as_deref() == Some(task_id.as_str()))
- .expect("cancelled durable session remains available");
+ let row = super::driver_sessions_for_parent(
+ &live.data.dispatch_ctx(),
+ workspace.path(),
+ &parent_session,
+ Some("paused-cancel-rpc-thread"),
+ )
+ .await
+ .expect("driver session")
+ .into_iter()
+ .find(|row| row.current_task_id.as_deref() == Some(task_id.as_str()))
+ .expect("cancelled durable session remains available");
assert_eq!(row.status, DurableSubagentStatus::Failed);
- assert!(row
- .latest_error
- .as_deref()
- .is_some_and(|error| error.contains("user requested stop")));
+ assert!(
+ row.latest_error
+ .as_deref()
+ .is_some_and(|error| error.contains("user requested stop"))
+ );
let deliveries = pending_for_ctx(
&live.data.dispatch_ctx(),
workspace.path(),
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.rs
index 7b5bf18f1f..7a39cd7d54 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
@@ -151,11 +151,11 @@ async fn profile_scope_cannot_cancel_another_profiles_driver_child() {
"shared-profile-parent-session",
Some(thread_id),
)
- .await
- .expect("driver child row readable")
- .into_iter()
- .find(|row| row.current_task_id.as_deref() == Some(task_id.as_str()))
- .expect("durable row belongs to the live child");
+ .await
+ .expect("driver child row readable")
+ .into_iter()
+ .find(|row| row.current_task_id.as_deref() == Some(task_id.as_str()))
+ .expect("durable row belongs to the live child");
assert_eq!(row_before.status, DurableSubagentStatus::Running);
assert_eq!(row_before.parent_session, "shared-profile-parent-session");
assert_eq!(row_before.parent_thread_id.as_deref(), Some(thread_id));
@@ -209,11 +209,11 @@ async fn profile_scope_cannot_cancel_another_profiles_driver_child() {
"shared-profile-parent-session",
Some(thread_id),
)
- .await
- .expect("driver child row remains readable")
- .into_iter()
- .find(|row| row.subagent_session_id == row_before.subagent_session_id)
- .expect("foreign attempt keeps Alice's durable row");
+ .await
+ .expect("driver child row remains readable")
+ .into_iter()
+ .find(|row| row.subagent_session_id == row_before.subagent_session_id)
+ .expect("foreign attempt keeps Alice's durable row");
assert_eq!(after_bob.status, DurableSubagentStatus::Running);
assert_eq!(after_bob.current_task_id, row_before.current_task_id);
assert_eq!(after_bob.latest_error, row_before.latest_error);
@@ -242,11 +242,11 @@ async fn profile_scope_cannot_cancel_another_profiles_driver_child() {
"shared-profile-parent-session",
Some(thread_id),
)
- .await
- .expect("unbound attempt leaves driver child row readable")
- .into_iter()
- .find(|row| row.subagent_session_id == row_before.subagent_session_id)
- .expect("unbound attempt keeps Alice's durable row");
+ .await
+ .expect("unbound attempt leaves driver child row readable")
+ .into_iter()
+ .find(|row| row.subagent_session_id == row_before.subagent_session_id)
+ .expect("unbound attempt keeps Alice's durable row");
assert_eq!(after_unbound.status, DurableSubagentStatus::Running);
assert_eq!(after_unbound.current_task_id, row_before.current_task_id);
assert_eq!(after_unbound.latest_error, row_before.latest_error);
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
index 0c9788e0b4..4b99e7eec9 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
@@ -37,12 +37,9 @@ pub(super) async fn driver_sessions_for_parent(
sessions
.into_iter()
.map(|session| {
- let parent_epoch = parent_epoch_for_context(
- ctx,
- workspace_dir,
- session.subagent_session_id.clone(),
- )
- .map_err(|error| error.to_string())?;
+ let parent_epoch =
+ parent_epoch_for_context(ctx, workspace_dir, session.subagent_session_id.clone())
+ .map_err(|error| error.to_string())?;
Ok(host_projection(session, parent_epoch))
})
.collect()
@@ -242,7 +239,7 @@ async fn spawn_subagent_reports_a_stopped_child_as_incomplete_progress() {
stop,
..
}) if agent_id == "task_manager_agent" && event_task_id == task_id => {
- break (output, stop)
+ break (output, stop);
}
Some(crate::progress::AgentProgress::SubagentFailed {
agent_id,