Skip to content

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

fix(subagent_control): record cancellation as a failure

Steven Enamakele9348a25fa9f
diff --git a/crates/openhuman-core/src/agent_runs/subagent_control.rs b/crates/openhuman-core/src/agent_runs/subagent_control.rs
index 246ff81296..11dc86f9c9 100644
--- a/crates/openhuman-core/src/agent_runs/subagent_control.rs
+++ b/crates/openhuman-core/src/agent_runs/subagent_control.rs
@@ -183,13 +183,21 @@ fn handle_subagent_cancel(ctx: DispatchCtx, params: Map<String, Value>) -> Contr
None => "You cancelled this background sub-agent before it finished."
.to_string(),
};
- background_completions::record_completion(
+ let error = match reason
+ .as_deref()
+ .map(str::trim)
+ .filter(|reason| !reason.is_empty())
+ {
+ Some(reason) => format!("cancelled by user. Reason: {reason}"),
+ None => "cancelled by user".to_string(),
+ };
+ background_completions::record_failure(
&ctx,
&meta.workspace_dir,
&meta.parent_session,
&task_id,
- meta.agent_id.clone(),
- summary,
+ meta.agent_id,
+ &error,
meta.parent_thread_id.clone(),
)
.await;