Skip to content

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

fix(subagent): settle paused driver cancel and preserve existing error

Steven Enamakelc37ce917323a
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_driver.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_driver.rs
index 0138fe2290..6fbdee1e73 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_driver.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_driver.rs
@@ -281,7 +281,9 @@ pub fn mark_driver_pause_cancelled(
return Ok(false);
}
session.status = DurableSubagentStatus::Failed;
- session.latest_error = Some("cancelled by user".into());
+ session
+ .latest_error
+ .get_or_insert_with(|| "cancelled by user".into());
session.updated_at = chrono::Utc::now().to_rfc3339();
session.last_used_at = session.updated_at.clone();
store.save(&sessions)?;
diff --git a/crates/openhuman-core/src/agent_runs/subagent_control.rs b/crates/openhuman-core/src/agent_runs/subagent_control.rs
index bc1291e0c1..311144f780 100644
--- a/crates/openhuman-core/src/agent_runs/subagent_control.rs
+++ b/crates/openhuman-core/src/agent_runs/subagent_control.rs
@@ -159,6 +159,9 @@ fn handle_subagent_cancel(ctx: DispatchCtx, params: Map<String, Value>) -> Contr
// Active driver jobs finish through the awaited host hook.
// A paused job has already returned from that hook, so this
// handler settles and reports that one terminal transition.
+ if let Some(paused) = meta.driver_pause.as_ref() {
+ settle_paused_driver_cancel(&ctx, paused, reason.as_deref()).await?;
+ }
(true, None)
} else {
let summary = match reason.as_deref().map(str::trim).filter(|r| !r.is_empty()) {