Skip to content

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

fix(orchestration): propagate failure cause to subagent stop events

Steven Enamakel6866ac2f6070
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent_host.rs b/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent_host.rs
index 82f43e6c34..743720165a 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent_host.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/continue_subagent_host.rs
@@ -587,7 +587,10 @@ impl ContinueSubagentTool {
worktree_path: None,
changed_files: Vec::new(),
dirty_status: None,
- stop: incomplete_stop(reason),
+ stop: incomplete_stop(
+ reason,
+ outcome.failure_cause.clone(),
+ ),
})
.await;
}
@@ -609,6 +612,7 @@ impl ContinueSubagentTool {
&outcome.agent_id,
&outcome.task_id,
reason,
+ outcome.failure_cause.clone(),
envelope,
))
}
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 f56286234a..dce7011e39 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_outcomes.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_outcomes.rs
@@ -77,8 +77,16 @@ pub(crate) fn incomplete_envelope(
/// How a sub-agent handed back as `Incomplete { reason }` was stopped
/// (iteration cap or failure breaker), for its `SubagentCompleted` event.
-pub(crate) fn incomplete_stop(reason: &str) -> Option<tinyagents_harness::turn_stop::TurnStop> {
- Some(crate::agent::session_host::stop_summary::stop_from_incomplete(reason))
+pub(crate) fn incomplete_stop(
+ reason: &str,
+ failure_cause: Option<tinyagents_harness::no_progress::ClassifiedStopCause>,
+) -> Option<tinyagents_harness::turn_stop::TurnStop> {
+ Some(
+ crate::agent::session_host::stop_summary::stop_from_incomplete_with_cause(
+ reason,
+ failure_cause,
+ ),
+ )
}
/// The parent's tool result for a sub-agent the harness stopped early: a
@@ -91,9 +99,13 @@ pub(crate) fn stopped_subagent_result(
agent_id: &str,
task_id: &str,
reason: &str,
+ failure_cause: Option<tinyagents_harness::no_progress::ClassifiedStopCause>,
envelope: String,
) -> ToolResult {
- let stop = crate::agent::session_host::stop_summary::stop_from_incomplete(reason);
+ let stop = crate::agent::session_host::stop_summary::stop_from_incomplete_with_cause(
+ reason,
+ failure_cause,
+ );
log::debug!(
"[subagent] {tool_name} child stopped early agent_id={agent_id} task_id={task_id} \
{}; returning a failed tool result",
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs
index 1b0a1175ac..bf16f0b61d 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs
@@ -475,7 +475,10 @@ impl SpawnSubagentTool {
worktree_path: None,
changed_files: Vec::new(),
dirty_status: None,
- stop: incomplete_stop(reason),
+ stop: incomplete_stop(
+ reason,
+ outcome.failure_cause.clone(),
+ ),
})
.await;
}
@@ -499,6 +502,7 @@ impl SpawnSubagentTool {
&outcome.agent_id,
&outcome.task_id,
reason,
+ outcome.failure_cause.clone(),
envelope,
))
}
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rs b/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rs
index 87479d06ee..50b6f218f6 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rs
@@ -558,7 +558,10 @@ pub(crate) async fn dispatch_subagent_with_live_parent(
worktree_path: None,
changed_files: Vec::new(),
dirty_status: None,
- stop: incomplete_stop(reason),
+ stop: incomplete_stop(
+ reason,
+ outcome.failure_cause.clone(),
+ ),
})
.await;
}
@@ -576,6 +579,7 @@ pub(crate) async fn dispatch_subagent_with_live_parent(
&outcome.agent_id,
&outcome.task_id,
reason,
+ outcome.failure_cause.clone(),
incomplete_envelope(tool_name, reason, &outcome.output, mode),
))
}