Skip to content

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

test(orchestration): read driver rows through the session helper

Steven Enamakele05ec001c304
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_control_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_control_tests.rs
index 6c06fb1644..9d4611bb3f 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_control_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_control_tests.rs
@@ -198,9 +198,14 @@ async fn unscoped_web_stop_cancels_a_running_driver_subagent() {
})
.await
.expect("driver child cancellation settles");
- let stopped_snapshot =
- crate::core::runtime::CoreContext::sync_scope(Arc::clone(&core), || store.load())
- .expect("stopped durable row readable");
+ let stopped_snapshot = super::driver_sessions_for_parent(
+ &dispatch,
+ workspace.path(),
+ "stop-detached-subagent-session",
+ Some(thread_id),
+ )
+ .await
+ .expect("stopped driver row readable");
let stopped_snapshot = serde_json::to_string(&stopped_snapshot).expect("encode stopped row");
let repeated = crate::core::runtime::CoreContext::scope(
@@ -210,9 +215,14 @@ async fn unscoped_web_stop_cancels_a_running_driver_subagent() {
.await
.expect("repeated stop");
assert_eq!(repeated.value["subagents_cancelled"], serde_json::json!(0));
- let after_repeat =
- crate::core::runtime::CoreContext::sync_scope(Arc::clone(&core), || store.load())
- .expect("repeated stop leaves durable row readable");
+ let after_repeat = super::driver_sessions_for_parent(
+ &dispatch,
+ workspace.path(),
+ "stop-detached-subagent-session",
+ Some(thread_id),
+ )
+ .await
+ .expect("repeated stop leaves driver row readable");
assert_eq!(
serde_json::to_string(&after_repeat).expect("encode repeated stop row"),
stopped_snapshot,
@@ -222,7 +232,6 @@ async fn unscoped_web_stop_cancels_a_running_driver_subagent() {
#[tokio::test]
async fn cancel_of_a_completed_driver_child_reports_completed_without_rewriting_its_session() {
- use crate::agent::orchestration::subagent_sessions::SubagentSessionStore;
use crate::core::runtime::{ContextOverlay, CoreContext, DispatchCtx, DomainSet};
let workspace = tempfile::TempDir::new().expect("workspace");
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 ffda0b9bf8..7b5bf18f1f 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
@@ -203,8 +203,14 @@ async fn profile_scope_cannot_cancel_another_profiles_driver_child() {
SubAgentJobStatus::Running,
"foreign cancellation leaves the owner job running"
);
- let after_bob = CoreContext::sync_scope(Arc::clone(&alice), || store.load())
- .expect("durable child row remains readable")
+ let after_bob = super::driver_sessions_for_parent(
+ &alice_ctx,
+ &workspace,
+ "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");
@@ -230,8 +236,14 @@ async fn profile_scope_cannot_cancel_another_profiles_driver_child() {
.is_none(),
"SaaS cancellation without a profile fails closed"
);
- let after_unbound = CoreContext::sync_scope(Arc::clone(&alice), || store.load())
- .expect("unbound attempt leaves durable child row readable")
+ let after_unbound = super::driver_sessions_for_parent(
+ &alice_ctx,
+ &workspace,
+ "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");
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 749df4e821..0c9788e0b4 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
@@ -29,7 +29,8 @@ pub(super) async fn driver_sessions_for_parent(
parent_session,
parent_thread_id.map(str::to_owned),
None,
- )?
+ )
+ .map_err(|error| error.to_string())?
.list_for_parent(parent_session, parent_thread_id)
.await
.map_err(|error| error.to_string())?;