Skip to content

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

test(orchestration): look up driver jobs by lifecycle key in e2e tests

Steven Enamakelc63fc382082c
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 093aa905cf..f18e9bccc9 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
@@ -64,6 +64,8 @@ async fn unscoped_web_stop_cancels_a_running_driver_subagent() {
.with_thread(thread_id),
host,
);
+ let detached = crate::agent::subagent_host::detached_subagent_parent(&live, "stop-child")
+ .expect("detached parent");
let accepted = crate::core::runtime::CoreContext::scope(
Arc::clone(&core),
Box::pin(
@@ -76,8 +78,7 @@ async fn unscoped_web_stop_cancels_a_running_driver_subagent() {
}),
None,
live.data.child(),
- crate::agent::subagent_host::detached_subagent_parent(&live, "stop-child")
- .expect("detached parent"),
+ detached.clone(),
),
),
)
@@ -92,8 +93,6 @@ async fn unscoped_web_stop_cancels_a_running_driver_subagent() {
.and_then(|value| serde_json::from_str::<serde_json::Value>(value).ok())
.and_then(|value| value["task_id"].as_str().map(str::to_owned))
.expect("accepted child includes its task ID");
- let detached = crate::agent::subagent_host::detached_subagent_parent(&live, "stop-child")
- .expect("detached parent");
let lifecycle_key = tinyagents_orchestration::subagent::SubagentTaskKey::from_context(
&detached,
task_id.clone(),
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 a5940ac9c5..85eaada331 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
@@ -125,7 +125,7 @@ async fn profile_scope_cannot_cancel_another_profiles_driver_child() {
}),
None,
live.data.child(),
- detached,
+ detached.clone(),
),
)
.await
@@ -139,6 +139,11 @@ async fn profile_scope_cannot_cancel_another_profiles_driver_child() {
.and_then(|value| serde_json::from_str::<serde_json::Value>(value).ok())
.and_then(|value| value["task_id"].as_str().map(str::to_owned))
.expect("accepted child includes public task ID");
+ let lifecycle_key = tinyagents_orchestration::subagent::SubagentTaskKey::from_context(
+ &detached,
+ task_id.clone(),
+ None,
+ );
tokio::time::timeout(std::time::Duration::from_secs(5), started_rx.recv())
.await
.expect("child reached the scripted provider gate")
@@ -152,20 +157,11 @@ async fn profile_scope_cannot_cancel_another_profiles_driver_child() {
"shared-profile-parent-session",
Some(thread_id),
);
- let parent_scope = tinyagents_orchestration::subagent::ParentJobScope::new(
- tinytools::WorkspaceDescriptor::new(&workspace),
- thread_id,
- );
+ let alice_job_id = alice_jobs
+ .driver_job_for_key(&lifecycle_key, &alice_owner)
+ .expect("Alice owns a live child job for this lifecycle key");
let alice_job = alice_jobs
- .list_for_parent_scope(&alice_owner, &parent_scope)
- .expect("read Alice's owner-scoped driver jobs")
- .into_iter()
- .find(|job| {
- job.extensions
- .get("task_id")
- .and_then(serde_json::Value::as_str)
- == Some(task_id.as_str())
- })
+ .get(alice_job_id.as_str())
.expect("real child is registered in Alice's scoped driver registry");
assert_eq!(alice_job.status, SubAgentJobStatus::Running);