Skip to content

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

fix(orchestration): abort orphaned task on duplicate child id

Steven Enamakel42471906fe62
diff --git a/src/openhuman/agent/orchestration/ops.rs b/src/openhuman/agent/orchestration/ops.rs
index 53ddb1b0ad..417e08e326 100644
--- a/src/openhuman/agent/orchestration/ops.rs
+++ b/src/openhuman/agent/orchestration/ops.rs
@@ -426,6 +426,12 @@ impl AgentOrchestrationSession {
)
.map_err(|err| {
log::error!("[agent_orchestration] duplicate detached child id: {err}");
+ // Registration failed, so the registry holds no record of this
+ // task and `abort_all`/`cancel_all` can never reach it. Dropping
+ // `handle` here would only detach the `JoinHandle` — the spawned
+ // task keeps running orphaned. Abort it explicitly so a failed
+ // spawn never leaves a live, unreachable child behind.
+ handle.abort();
OrchestrationError::InvalidSpawnRequest
})?;