Skip to content

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

fix(orchestration): handle unexecuted tool calls from subagents

Steven Enamakel4f8b0d357912
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_completion.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_completion.rs
index 3bb44d99d7..02d151b67f 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_completion.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_completion.rs
@@ -56,7 +56,16 @@ pub(super) fn make_completion(
let result = result.map_err(anyhow::Error::msg);
match result {
Ok(outcome) => {
- let status = outcome.status.clone();
+ let status = if matches!(outcome.status, SubagentRunStatus::Completed)
+ && super::super::dispatch::is_unexecuted_tool_call_stub(&outcome.output)
+ {
+ SubagentRunStatus::Incomplete {
+ reason: "returned an unexecuted tool call instead of a result"
+ .to_string(),
+ }
+ } else {
+ outcome.status.clone()
+ };
match status.clone() {
SubagentRunStatus::Completed => {
if let Err(err) = subagent_sessions::mark_finished(
@@ -310,7 +319,10 @@ pub(super) fn make_completion(
}
Err(err) => {
let error = err.to_string();
- let failure = error.clone();
+ let failure = super::super::dispatch::format_subagent_failure(
+ "spawn_subagent",
+ &error,
+ );
if let Err(store_err) = subagent_sessions::mark_failed(
&background_store,
&background_subagent_session_id,