Skip to content

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

fix(subagent_sessions): avoid borrow conflict and scope close to owned sessions

Steven Enamakeld5f081b05512
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs
index 0730500967..04b815facf 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs
@@ -141,6 +141,7 @@ pub fn cancel_driver_job_for_observed_session(
};
let key = session
.lifecycle_key
+ .clone()
.filter(|key| key.task_id == task_id && key.thread_id.as_deref() == parent_thread_id)
.or_else(|| {
resolve_lifecycle_key(
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rs
index 24b2136893..b11ea8c169 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rs
@@ -208,7 +208,13 @@ impl TinySessionStore for OpenHumanTinySubagentSessionStore {
}
async fn close(&self, id: &str) -> Result<bool, SubagentError> {
- let Some(session) = self.get(id).await? else {
+ let session = self
+ .store
+ .load()
+ .map_err(SubagentError::Persistence)?
+ .into_iter()
+ .find(|session| session.subagent_session_id == id && self.is_owned(session));
+ let Some(session) = session else {
return Ok(false);
};
if let Some(jobs) = &self.jobs {