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 cancels through the host hook

Steven Enamakel557c98466df5
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 c15feff818..31086b7389 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
@@ -258,11 +258,7 @@ pub fn cancel_driver_job_by_task(
};
let already_finished = match session.status {
DurableSubagentStatus::Idle => {
- let finished = typed_finished()?;
- if finished.is_none() {
- return Ok(None);
- }
- finished
+ Some(tinyagents_orchestration::subagent::FinishedOutcome::Completed)
}
DurableSubagentStatus::Failed => match typed_finished()? {
Some(finished) => Some(finished),
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_result.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_result.rs
index 7e1c838f33..0513eeef9d 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_result.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_result.rs
@@ -38,6 +38,9 @@ pub(super) async fn resolve_inline_driver_outcome(
.lock()
.unwrap_or_else(|poisoned| poisoned.into_inner())
.remove(task_key);
+ if let Some(cached) = cached.clone() {
+ return Ok((cached, public_job_id));
+ }
// The driver's persistence CAS result is authoritative. Another
// invocation can win terminal/pause persistence while this executor's
diff --git a/crates/openhuman-core/src/agent_runs/subagent_control.rs b/crates/openhuman-core/src/agent_runs/subagent_control.rs
index 311144f780..bc1291e0c1 100644
--- a/crates/openhuman-core/src/agent_runs/subagent_control.rs
+++ b/crates/openhuman-core/src/agent_runs/subagent_control.rs
@@ -159,9 +159,6 @@ 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()) {
diff --git a/scripts/ci/check-openhuman-rust-layout.mjs b/scripts/ci/check-openhuman-rust-layout.mjs
index 101825a435..6981aa47c9 100644
--- a/scripts/ci/check-openhuman-rust-layout.mjs
+++ b/scripts/ci/check-openhuman-rust-layout.mjs
@@ -33,7 +33,7 @@ const LEGACY_LIMIT_ENTRIES = [
// state moved to tinyagents-runtime; this remaining composition is split in
// a follow-up without reintroducing an old harness/session exception.
["crates/openhuman-core/src/agent/session_host/builder/factory.rs", 964],
- ["crates/openhuman-core/src/agent/subagent_host/lifecycle.rs", 958],
+ ["crates/openhuman-core/src/agent/subagent_host/lifecycle.rs", 871],
["crates/openhuman-core/src/agent/subagent_host/ops/runner.rs", 1041],
["crates/openhuman-core/src/web_chat/progress_bridge.rs", 1117],
// These established external test modules grew with upstream coverage. Pin