Skip to content

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

test(orchestration): improve paused-session assertion diagnostics

Steven Enamakel46ac1487c10f
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 5e25e08131..bb45181781 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
@@ -168,14 +168,13 @@ async fn spawn_subagent_with_same_task_key_resumes_paused_job_through_shared_dri
),
task_key: "pause-resume-fixture".into(),
};
- let (saved_key, reusable_session_id) =
- crate::core::runtime::CoreContext::sync_scope(Arc::clone(&_core), || {
+ let (saved_key, reusable_session_id) = crate::core::runtime::CoreContext::sync_scope(
+ Arc::clone(&_core),
+ || {
let mut records = sessions.load().expect("load paused row before corruption");
let row = records
.iter_mut()
- .find(|session| {
- session.subagent_session_id == before_session.subagent_session_id
- })
+ .find(|session| session.subagent_session_id == before_session.subagent_session_id)
.expect("paused row to corrupt");
row.lifecycle_key
.as_mut()
@@ -188,21 +187,33 @@ async fn spawn_subagent_with_same_task_key_resumes_paused_job_through_shared_dri
let reread = sessions.load().expect("reread corrupted paused row");
let persisted = reread
.iter()
- .find(|session| {
- session.subagent_session_id == before_session.subagent_session_id
- })
+ .find(|session| session.subagent_session_id == before_session.subagent_session_id)
.expect("corrupted paused row remains persisted");
let reusable = crate::agent::orchestration::subagent_sessions::find_reusable(
&sessions,
&selector,
)
.expect("find matching paused session")
- .expect("the exact spawn selector still selects the paused session");
+ .unwrap_or_else(|| {
+ panic!(
+ "exact spawn selector did not select corrupted paused row: selector={selector:?}; persisted=(parent_session={:?}, parent_thread_id={:?}, agent_id={:?}, model={:?}, sandbox_mode={:?}, action_root={:?}, task_key={:?}, status={:?}, reusable={})",
+ persisted.parent_session,
+ persisted.parent_thread_id,
+ persisted.agent_id,
+ persisted.model,
+ persisted.sandbox_mode,
+ persisted.action_root,
+ persisted.task_key,
+ persisted.status,
+ persisted.reusable,
+ )
+ });
(
persisted.lifecycle_key.clone().expect("persisted key"),
reusable.subagent_session_id,
)
- });
+ },
+ );
assert_ne!(saved_key, original_lifecycle_key);
assert_eq!(
reusable_session_id, before_session.subagent_session_id,
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 f18e9bccc9..ceb8e68583 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
@@ -68,19 +68,17 @@ async fn unscoped_web_stop_cancels_a_running_driver_subagent() {
.expect("detached parent");
let accepted = crate::core::runtime::CoreContext::scope(
Arc::clone(&core),
- Box::pin(
- SpawnSubagentTool::new().execute_with_live_parent_context(
- json!({
- "agent_id": "task_manager_agent",
- "prompt": "wait for the thread stop",
- "model": "test-model",
- "task_key": "stop detached child"
- }),
- None,
- live.data.child(),
- detached.clone(),
- ),
- ),
+ Box::pin(SpawnSubagentTool::new().execute_with_live_parent_context(
+ json!({
+ "agent_id": "task_manager_agent",
+ "prompt": "wait for the thread stop",
+ "model": "test-model",
+ "task_key": "stop detached child"
+ }),
+ None,
+ live.data.child(),
+ detached.clone(),
+ )),
)
.await
.expect("spawn child");