Skip to content

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

fix(orchestration): propagate stage cancellation into run data

Steven Enamakel25a2571c83ac
diff --git a/crates/openhuman-core/src/agent/orchestration/delegation.rs b/crates/openhuman-core/src/agent/orchestration/delegation.rs
index cf5f5e0965..93ed724f52 100644
--- a/crates/openhuman-core/src/agent/orchestration/delegation.rs
+++ b/crates/openhuman-core/src/agent/orchestration/delegation.rs
@@ -45,11 +45,12 @@ pub(crate) fn stage_run_contexts(
) -> tinyagents_harness::Result<(RunContext<OpenHumanRunContext>, OpenHumanRunContext)> {
let mut stage_context = stage_parent.data.child();
stage_context.workspace = workspace.or(stage_context.workspace);
- let stage_run = stage_parent.child(
+ let mut stage_run = stage_parent.child(
RunConfig::new(format!("delegation-stage-{}", uuid::Uuid::new_v4())),
stage_context.clone(),
)?;
stage_context.cancellation = stage_run.cancellation.clone();
+ stage_run.data.cancellation = stage_run.cancellation.clone();
Ok((stage_run, stage_context))
}
diff --git a/crates/openhuman-core/src/agent/orchestration/delegation_tests.rs b/crates/openhuman-core/src/agent/orchestration/delegation_tests.rs
index e5a99d62b7..e489395c2a 100644
--- a/crates/openhuman-core/src/agent/orchestration/delegation_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/delegation_tests.rs
@@ -14,6 +14,7 @@ fn stage_host_data_carries_the_stage_runs_linked_token() {
graph_parent.cancellation.cancel();
assert!(stage_run.cancellation.is_cancelled());
assert!(stage_context.cancellation.is_cancelled());
+ assert!(stage_run.data.cancellation.is_cancelled());
}
#[test]
@@ -24,6 +25,8 @@ fn cancelling_a_stage_spares_the_graph_and_its_siblings() {
stage_a.cancellation.cancel();
assert!(ctx_a.cancellation.is_cancelled());
+ assert!(stage_a.data.cancellation.is_cancelled());
+ assert!(!stage_b.data.cancellation.is_cancelled());
assert!(!graph_parent.cancellation.is_cancelled());
assert!(!graph_parent.data.cancellation.is_cancelled());
assert!(!stage_b.cancellation.is_cancelled());