Skip to content

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

test(orchestration): cover dispatch outcomes and parent context retention

Steven Enamakel1667729a5b85
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_outcomes.rs b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_outcomes.rs
index d3acefd93d..170b1c00a5 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_outcomes.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_outcomes.rs
@@ -32,3 +32,7 @@ pub(crate) fn incomplete_stop(
),
)
}
+
+#[cfg(test)]
+#[path = "dispatch_outcomes_tests.rs"]
+mod tests;
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_outcomes_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_outcomes_tests.rs
new file mode 100644
index 0000000000..48c16d362e
--- /dev/null
+++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_outcomes_tests.rs
@@ -0,0 +1,29 @@
+use super::*;
+
+#[test]
+fn async_completion_detects_unexecuted_tool_call_stubs() {
+ assert!(is_unexecuted_tool_call_stub(
+ "<tool_call>{\"name\": \"GMAIL_LIST_MESSAGES\", \"arguments\": {}}</tool_call>"
+ ));
+ assert!(is_unexecuted_tool_call_stub(
+ "{\n \"tool_calls\": [{\"name\": \"GMAIL_FETCH_EMAILS\"}]\n}"
+ ));
+ assert!(!is_unexecuted_tool_call_stub(
+ "I found 3 job emails. I used <tool_call>GMAIL_FETCH_EMAILS</tool_call> to read them."
+ ));
+ assert!(!is_unexecuted_tool_call_stub(
+ "The \"tool_use\" field is how the provider reports a call."
+ ));
+}
+
+#[test]
+fn delegated_failures_keep_the_terminal_inference_failure_marker() {
+ let error = format_subagent_failure(
+ "spawn_subagent",
+ "all providers/models failed: model 'example' returned HTTP 404",
+ );
+ assert!(error.contains("spawn_subagent failed and did not complete"));
+ assert!(error.contains("Do not treat this as success"));
+ assert!(error.contains("fabricate output"));
+ assert!(error.contains("all providers/models failed"));
+}
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs
index fc94804427..9b4d6b7e76 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_async_tests.rs
@@ -285,6 +285,10 @@ async fn headless_spawn_is_async_and_reports_its_result_to_the_run_log() {
parent.session_id = "headless-spawn-session".into();
parent.on_progress = Some(progress_tx);
let (live, _core) = headless_core_backed_parent(workspace.path(), parent);
+ assert!(
+ live.data.dispatch_ctx().resolved().is_some(),
+ "the headless parent carrier retains its core context"
+ );
let result = SpawnSubagentTool::new()
.execute_with_live_parent_context(
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 e17f912c10..f67f814762 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
@@ -38,6 +38,10 @@ async fn spawn_subagent_with_same_task_key_resumes_paused_job_through_shared_dri
"continue-paused-e2e",
"continue-paused-e2e-thread",
);
+ assert!(
+ live.data.dispatch_ctx().resolved().is_some(),
+ "the parent carrier retains its core context"
+ );
let paused = SpawnSubagentTool::new()
.execute_with_live_parent_context(
json!({
@@ -316,6 +320,10 @@ async fn cancelling_a_paused_driver_settles_once_with_its_reason() {
"paused-cancel-rpc-parent",
"paused-cancel-rpc-thread",
);
+ assert!(
+ live.data.dispatch_ctx().resolved().is_some(),
+ "the parent carrier retains its core context"
+ );
let parent_cancellation = live.data.child().cancellation;
let jobs =
(*crate::core::runtime::slot_for::<SubAgentJobRegistry>(&live.data.dispatch_ctx())).clone();