Skip to content

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

refactor(spawn_subagent): drop fleet tool set from async spawn payloads

Steven Enamakel2420247e8fd6
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_projection.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_projection.rs
index 4241378ce9..16d4f409b6 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_projection.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_projection.rs
@@ -1,20 +1,5 @@
-// Async delivery is thread-addressed: the finished result is inserted back into the
-// parent chat thread as a follow-up turn (`background_delivery`). Outside a chat turn
-// (flow `agent` nodes, CLI and cron runs intentionally have no parent thread to deliver
-// into, so `background_delivery::deliver_batch` logs "dropping headless batch" and the
-// (possibly real, completed) work is silently discarded — the caller sees "Accepted" and
-// never learns the result never arrived. Fail loudly instead: the caller has a
-// synchronous alternative (`spawn_subagent` with `blocking: true`, or a `delegate_*`
-// tool). Both of those self-heal to blocking dispatch in this situation rather than
-// reaching this guard — see the `has_delivery_thread` checks in `spawn_subagent_surface.rs` and
-// `subagent_dispatch_host.rs::dispatch_subagent`. Only a *direct* `spawn_subagent` call lands
-// here.
-// The follow-up vocabulary offered back to the parent is limited to
-// the fleet tools visible on *this turn* (see `fleet_tools`), not
-// just the parent definition's static scope: a hide or named
-// restriction can narrow the turn's real tool surface below what the
-// definition alone would suggest, and offering a control the parent
-// cannot currently call invites a denied tool call.
+// Every child is detached. Chat parents receive a later delivery; headless
+// callers retain the result in their run log.
fn accepted_spawn_result(
task_id: &str,
session_id: &str,
@@ -22,17 +7,17 @@ fn accepted_spawn_result(
worker_thread_id: Option<&str>,
reused: bool,
reuse_decision: &str,
- fleet: &FleetToolSet,
+ task_key: &str,
) -> ToolResult {
let payload = async_subagent_ref_payload(
task_id,
session_id,
+ task_key,
agent_id,
worker_thread_id,
reused,
reuse_decision,
"running",
- fleet,
);
let payload_json = match serde_json::to_string(&payload) {
Ok(serialized) => {
@@ -54,7 +39,6 @@ fn accepted_spawn_result(
ToolResult::success(format_async_subagent_accepted(
payload["agent_id"].as_str().unwrap_or("subagent"),
&payload_json,
- fleet,
))
}
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs
index 265c1f4941..c3d8712278 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs
@@ -1,7 +1,6 @@
//! The single asynchronous sub-agent spawn surface.
use super::subagent_abort_report::AbortReport;
-use crate::agent::orchestration::fleet_tools::FleetToolSet;
use crate::agent::orchestration::running_subagents;
use crate::agent::orchestration::subagent_sessions::{
self, DurableSubagentStatus, SubagentSessionSelector, SubagentSessionStore,
@@ -381,9 +380,7 @@ fn finish_spawn_registration(
fn format_async_subagent_accepted(
agent_id: &str,
payload_json: &str,
- fleet: &FleetToolSet,
) -> String {
- let _ = fleet;
format!(
"Accepted async sub-agent `{agent_id}`. Its result is delivered automatically. To continue or answer a clarification, call `spawn_subagent` again with the same task_key.
@@ -400,19 +397,18 @@ fn format_async_subagent_accepted(
fn async_subagent_ref_payload(
task_id: &str,
subagent_session_id: &str,
+ task_key: &str,
agent_id: &str,
worker_thread_id: Option<&str>,
reused: bool,
reuse_decision: &str,
status: &str,
- fleet: &FleetToolSet,
) -> serde_json::Value {
- let _ = fleet;
let instructions = json!({
"answer_or_resume": {
"tool": "spawn_subagent",
"description": "Continue this task or answer a clarification while preserving its context.",
- "arguments": { "agent_id": agent_id, "task_key": subagent_session_id, "prompt": "<follow-up or user answer>" }
+ "arguments": { "agent_id": agent_id, "task_key": task_key, "prompt": "<follow-up or user answer>" }
}
});
let next_actions = [
@@ -425,6 +421,8 @@ fn async_subagent_ref_payload(
"taskId": task_id,
"subagent_session_id": subagent_session_id,
"subagentSessionId": subagent_session_id,
+ "task_key": task_key,
+ "taskKey": task_key,
"agent_id": agent_id,
"agentId": agent_id,
"mode": "async",