The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(subagent): resolve lifecycle keys through the session store
Steven Enamakel5045349b1743
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.rsindex 26f73cdc27..9a2b0ededf 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@@ -384,6 +384,37 @@ pub fn resolve_lifecycle_key(Ok(key)}+/// Resolves and validates a task lifecycle key through the authenticated+/// TinyAgents session port. Product spawn/resume paths use this instead of+/// consulting the legacy host collection.+pub async fn resolve_driver_lifecycle_key(+ store: &dyn tinyagents_orchestration::subagent::SubagentSessionStore,+ session_or_task_id: &str,+ checkpoint_dir: &Path,+) -> Result<tinyagents_orchestration::subagent::SubagentTaskKey, String> {+ let session = store+ .get(session_or_task_id)+ .await+ .map_err(|error| format!("read durable subagent session: {error}"))?+ .ok_or_else(|| "durable subagent session not found".to_string())?;+ let task_id = session+ .current_task_id+ .as_deref()+ .ok_or_else(|| "durable subagent session has no current task".to_string())?;+ let key = if let Some(key) = session.lifecycle_key {+ key+ } else {+ crate::agent::subagent_host::load_subagent_checkpoint(checkpoint_dir, task_id)+ .map_err(|error| format!("legacy subagent checkpoint unavailable: {error}"))?+ .task_key+ .ok_or_else(|| "legacy subagent checkpoint has no lifecycle key".to_string())?+ };+ if key.task_id != task_id || key.thread_id.as_deref() != session.parent_thread_id.as_deref() {+ return Err("durable subagent lifecycle key does not match its owned session".into());+ }+ Ok(key)+}+#[cfg(test)]#[path = "ops_driver_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rsindex 44eff1358f..04bae0dd2b 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_host_impl.rs@@ -229,13 +229,13 @@ impl SpawnSubagentTool {));};let checkpoint_dir = parent.workspace_dir.join(".openhuman/subagent_checkpoints");- let original_key = match subagent_sessions::resolve_lifecycle_key(- &store,+ let original_key = match subagent_sessions::resolve_driver_lifecycle_key(+ driver_store.as_ref(),&session.subagent_session_id,- &parent_session,- parent_thread_id.as_deref(),&checkpoint_dir,- ) {+ )+ .await+ {Ok(key) => key,Err(error) => {return Ok(ToolResult::error(format!(