Skip to content

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

refactor(subagent): make async completion callback return a boxed future

Steven Enamakelee053ebda5e7
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs
index 65dfc1023b..9748595e3d 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs
@@ -21,9 +21,7 @@ use async_trait::async_trait;
use serde_json::json;
use std::sync::Arc;
use tinyagents_harness::context::{RunConfig, RunContext};
-use tinyagents_harness::run_queue::RunQueue;
use tinyagents_harness::tool::{ToolDispatch, ToolExecutionContext};
-use tinyagents_orchestration::subagent::DetachedSubagentStatus;
use tinyagents_session::transcript::TranscriptMessage;
use tinytools::ToolRunContext;
use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolResult};
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs
index ab72679043..ad28818af1 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs
@@ -370,7 +370,10 @@ impl SpawnAsyncSubagentTool {
);
let completion_core = dispatch.clone().into_core();
let completion_origin = detached_parent.data.origin.clone();
- let completion = move |_target: String, result: Result<SubagentRunOutcome, String>, emit_lifecycle_effects: bool| {
+ let completion = move |_target: String,
+ result: Result<SubagentRunOutcome, String>,
+ emit_lifecycle_effects: bool|
+ -> std::pin::Pin<Box<dyn std::future::Future<Output = ()> + Send>> {
let core = completion_core.clone();
let origin = completion_origin.clone();
let progress_sink = progress_sink.clone();
@@ -482,7 +485,6 @@ impl SpawnAsyncSubagentTool {
);
// An incomplete run may still have produced a full
// proposal before stalling — preserve it durably too.
- let status_output = framed.clone();
let framed = attach_workflow_proposal(
&background_dispatch,
&background_workspace_dir,
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
index d3d84f307e..ada7b1114b 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
@@ -804,14 +804,15 @@ impl SubagentExecutor<crate::agent::tinyagents::host::OpenHumanRunContext> for O
options.message_run_queue = execution.prepared.run_context.run_queue.clone();
let dispatch = options.run_context.dispatch_ctx();
let origin = options.run_context.origin.clone();
+ let input = execution
+ .prepared
+ .input
+ .last()
+ .map(Message::text)
+ .unwrap_or_default();
let run = Box::pin(super::ops::run_subagent_direct(
&definition,
- &execution
- .prepared
- .input
- .last()
- .map(Message::text)
- .unwrap_or_default(),
+ &input,
options.clone(),
));
let result = match dispatch.into_core() {