Skip to content

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

fix(subagent_host): use continuation key for callback lifecycle

Steven Enamakel66f7439b275a
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
index 779d2b0fda..3cda9bf8d7 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
@@ -386,6 +386,10 @@ async fn invoke_driver_tool_with_request(
)?;
let request_host = host_request.clone();
let request_task_id = task_id.clone();
+ let callback_lifecycle_key = continuation
+ .as_ref()
+ .map(|(key, _)| key.clone())
+ .unwrap_or_else(|| SubagentTaskKey::from_context(parent, task_id.clone(), None));
let request_continuation = continuation;
let dispatcher = DriverSubAgentTool::new(
"spawn_subagent",
@@ -459,7 +463,7 @@ async fn invoke_driver_tool_with_request(
ToolTimeout::Unbounded,
);
if let Some(completion) = completion {
- let callback_task_key = SubagentTaskKey::from_context(parent, task_id.clone(), None);
+ let callback_task_key = callback_lifecycle_key;
let host_outcome = Arc::clone(&bundle.host_outcome);
let failures = Arc::clone(&bundle.failures);
let persistence = Arc::clone(&bundle.persistence);