Skip to content

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

fix(orchestration): thread failure cause through incomplete subagent runs

Steven Enamakel9bf79f3887ab
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs b/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs
index c0bfc6a94c..f5fa5332d4 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs
@@ -548,7 +548,7 @@ pub(crate) async fn dispatch_subagent_with_live_parent(
// finished result or re-run the identical delegation unchanged
// (#4096). Still a lifecycle-completed run, so publish
// SubagentCompleted like the `Completed` arm.
- SubagentRunStatus::Incomplete { reason } => {
+ SubagentRunStatus::Incomplete { reason, failure_cause } => {
if emit_lifecycle_effects {
crate::agent::orchestration::subagent_events::publish_subagent_completed(
parent_session,
@@ -577,7 +577,7 @@ 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, failure_cause.as_ref()),
})
.await;
}
@@ -595,6 +595,7 @@ pub(crate) async fn dispatch_subagent_with_live_parent(
&outcome.agent_id,
&outcome.task_id,
reason,
+ failure_cause.as_ref(),
incomplete_envelope(tool_name, reason, &outcome.output, mode),
))
}
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs
index c062a99894..7788011281 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs
@@ -440,7 +440,7 @@ impl SpawnSubagentTool {
Ok(ToolResult::success(outcome.output))
}
- SubagentRunStatus::Incomplete { reason } => {
+ SubagentRunStatus::Incomplete { reason, failure_cause } => {
// The sub-agent stopped WITHOUT reaching its goal (a
// no-progress circuit breaker halted it, or it hit the
// iteration cap). Hand the orchestrator a structured
@@ -479,7 +479,7 @@ impl SpawnSubagentTool {
worktree_path: None,
changed_files: Vec::new(),
dirty_status: None,
- stop: incomplete_stop(reason),
+ stop: incomplete_stop(reason, failure_cause.as_ref()),
})
.await;
}
@@ -503,6 +503,7 @@ impl SpawnSubagentTool {
&outcome.agent_id,
&outcome.task_id,
reason,
+ failure_cause.as_ref(),
envelope,
))
}