Skip to content

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

fix(orchestration): rename running_subagents module to subagent

Steven Enamakelcf0e968c9975
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents.rs
index fd67c68fea..a2d3e87705 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents.rs
@@ -14,7 +14,7 @@
//! - a TinyAgents `SteeringHandle` in the process-local
//! `SteeringRegistry` while the child TinyAgents run is active, so
//! steer/collect controls can deliver directly to the crate queue;
-//! - a `watch::Receiver<SubagentStatus>` — so `wait_subagent` can block until the
+//! - a `watch::Receiver<DetachedSubagentStatus>` — so `wait_subagent` can block until the
//! child reaches a terminal status;
//! - an `AbortHandle` — used by `subagent_cancel`/`close_subagent` paths to stop
//! detached work.
@@ -37,7 +37,7 @@
//!
//! ## Module layout
//!
-//! - [`registry`] — the in-process table itself: [`SubagentStatus`],
+//! - [`registry`] — the in-process table itself: [`DetachedSubagentStatus`],
//! registration, and status channels.
//! - [`task_ledger`] — the durable per-workspace task store and the typed
//! lifecycle records mirrored into it.
@@ -67,7 +67,7 @@ pub(crate) use cancel::{
cancel_all, cancel_by_session_in_workspace, cancel_by_task, cancel_for_thread, stop_for_thread,
CancelledSubagent,
};
-pub(crate) use registry::{register, status_channel, SubagentResumeRef, SubagentStatus};
+pub(crate) use registry::{register, status_channel};
pub(crate) use resolve::{resume_ref_for_task_in_workspace, task_id_for_session_in_workspace};
pub(crate) use roster::active_subagents_context_block;
pub(crate) use steering::steer_control;
@@ -75,4 +75,4 @@ pub use steering::{steer, SteerError};
#[cfg(test)]
pub(crate) use task_ledger::task_records;
pub(crate) use task_ledger::{reconcile_orphaned_tasks_on_boot, task_record_for_task_in_workspace};
-pub(crate) use wait::{wait_in_workspace, WaitError, WaitOutcome};
+pub(crate) use wait::wait_in_workspace;
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rs
index 7360ea7106..36b324ac6e 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/task_ledger.rs
@@ -14,15 +14,13 @@ use std::sync::{Arc, OnceLock};
use tinyagents_graph::orchestration::{
open_jsonl_task_store_or_memory, reconcile_orphaned_tasks, InMemoryTaskStore,
- OrchestrationTaskFilter, OrchestrationTaskKind, OrchestrationTaskRecord,
- OrchestrationTaskResult, OrchestrationTaskSpec, OrchestrationTaskStatus, TaskStore,
- TaskStoreRegistry,
+ OrchestrationTaskFilter, OrchestrationTaskRecord, TaskStore, TaskStoreRegistry,
+};
+use tinyagents_orchestration::subagent::{
+ list_subagent_records, orphaned_subagent_reason, record_agent_id, record_cancelled as ledger_cancelled,
+ record_parent_session, record_spawned as ledger_spawned, subagent_record_for_task,
+ task_status_label, SpawnedSubagent, WaitError,
};
-use tinyagents_harness::ids::TaskId;
-
-use super::registry::DETACHED_LEDGER_TIMEOUT_MS;
-use super::wait::{WaitError, WaitOutcome};
-use super::SubagentStatus;
/// Where a workspace's detached-task ledger lives.
///
@@ -80,8 +78,8 @@ fn task_store() -> Arc<dyn TaskStore> {
task_store_for_workspace(&workspace)
}
-/// Record a freshly-spawned sub-agent in the store (`Pending` → `Running`).
-/// Insert errors (e.g. a re-used task id across tests) are intentionally ignored.
+/// Record a freshly-spawned sub-agent in the workspace's store (`Pending` →
+/// `Running`). Insert errors (e.g. a re-used task id across tests) are ignored.
pub(crate) fn record_spawned(
task_id: &str,
agent_id: &str,
@@ -91,82 +89,33 @@ pub(crate) fn record_spawned(
workspace_dir: &Path,
parent_thread_id: Option<&str>,
) {
- let store = task_store_for_workspace(workspace_dir);
- let root_run_id = session_parent_prefix
- .and_then(|prefix| prefix.split("__").next())
- .filter(|root| !root.is_empty())
- .unwrap_or(parent_session);
- let mut spec = OrchestrationTaskSpec::new(
- task_id.to_string(),
- OrchestrationTaskKind::SubAgent {
- agent: agent_id.to_string(),
+ let workspace = workspace_dir.display().to_string();
+ ledger_spawned(
+ task_store_for_workspace(workspace_dir).as_ref(),
+ &SpawnedSubagent {
+ task_id,
+ agent_id,
+ parent_session,
+ session_parent_prefix,
+ subagent_session_id,
+ workspace_dir: &workspace,
+ parent_thread_id,
},
- )
- .with_lineage(parent_session.to_string(), root_run_id.to_string())
- .with_timeout_ms(DETACHED_LEDGER_TIMEOUT_MS)
- .with_metadata("parentSession", parent_session.to_string())
- .with_metadata("rootSession", root_run_id.to_string())
- .with_metadata(
- "defaultWaitTimeoutMs",
- DETACHED_LEDGER_TIMEOUT_MS.to_string(),
- )
- .with_metadata("workspaceDir", workspace_dir.display().to_string());
- if let Some(session_parent_prefix) = session_parent_prefix {
- spec = spec.with_metadata("sessionParentPrefix", session_parent_prefix.to_string());
- }
- if let Some(parent_thread_id) = parent_thread_id {
- spec = spec
- .with_thread(parent_thread_id.to_string())
- .with_metadata("parentThreadId", parent_thread_id.to_string());
- }
- if let Some(subagent_session_id) = subagent_session_id {
- spec = spec.with_metadata("subagentSessionId", subagent_session_id.to_string());
- }
- let _ = store.insert(spec);
- let _ = store.mark_running(&TaskId::new(task_id));
-}
-
-/// Mirror a child's published [`SubagentStatus`] into the typed store. Transition
-/// errors (already terminal / cancelled) are ignored — first writer wins.
-pub(crate) fn record_status(workspace_dir: &Path, task_id: &str, status: &SubagentStatus) {
- let store = task_store_for_workspace(workspace_dir);
- let id = TaskId::new(task_id);
- log::debug!(
- "[running_subagents] recording task status task_id={} workspace_dir={} terminal={}",
- task_id,
- workspace_dir.display(),
- status.is_terminal()
);
- match status {
- SubagentStatus::Completed { output, .. } => {
- let _ = store.complete(&id, OrchestrationTaskResult::text(output.clone()));
- }
- SubagentStatus::Failed { error } => {
- let _ = store.fail(&id, error.clone());
- }
- SubagentStatus::AwaitingUser { .. } => {
- let _ = store.mark_awaiting(&id);
- }
- SubagentStatus::Running => {}
- }
}
/// Record a cancellation (`CancelRequested` → `Cancelled`) for `task_id`.
pub(crate) fn record_cancelled(workspace_dir: &Path, task_id: &str) {
- let store = task_store_for_workspace(workspace_dir);
- let id = TaskId::new(task_id);
log::debug!(
"[running_subagents] recording task cancellation task_id={} workspace_dir={}",
task_id,
workspace_dir.display()
);
- let _ = store.request_cancel(&id);
- let _ = store.mark_cancelled(&id);
+ ledger_cancelled(task_store_for_workspace(workspace_dir).as_ref(), task_id);
}
pub(crate) fn list_task_records(workspace_dir: &Path) -> Vec<OrchestrationTaskRecord> {
- let store = task_store_for_workspace(workspace_dir);
- store.list(OrchestrationTaskFilter::default().with_kind("sub_agent"))
+ list_subagent_records(task_store_for_workspace(workspace_dir).as_ref())
}
/// Restart/resume reconciliation for detached sub-agents (issue #4249 / 07.2
@@ -242,112 +191,16 @@ pub(crate) fn reconcile_orphaned_tasks_on_boot(workspace_dir: &Path) -> usize {
reconciled
}
-/// The reason an orphaned sub-agent record is settled with.
-///
-/// Built in one place because it is written twice — into the store by the
-/// reconciler, and into the lifecycle event the run ledger reads. If those two
-/// ever disagreed, the ledger would explain a failure differently from the
-/// record behind it.
-fn orphaned_subagent_reason(prior_status: OrchestrationTaskStatus) -> String {
- format!(
- "sub-agent orphaned by core restart (was `{}`)",
- task_status_label(prior_status)
- )
-}
-
-pub(crate) fn record_parent_session(record: &OrchestrationTaskRecord) -> Option<&str> {
- record
- .spec
- .metadata
- .get("parentSession")
- .map(String::as_str)
-}
-
-pub(crate) fn record_subagent_session_id(record: &OrchestrationTaskRecord) -> Option<&str> {
- record
- .spec
- .metadata
- .get("subagentSessionId")
- .map(String::as_str)
-}
-
-pub(crate) fn record_agent_id(record: &OrchestrationTaskRecord) -> String {
- match &record.spec.kind {
- OrchestrationTaskKind::SubAgent { agent } => agent.clone(),
- _ => "subagent".to_string(),
- }
-}
-
pub(crate) fn task_record_for_task_in_workspace(
workspace_dir: &Path,
task_id: &str,
parent_session: &str,
) -> Result<OrchestrationTaskRecord, WaitError> {
- let id = TaskId::new(task_id);
- let Some(record) = task_store_for_workspace(workspace_dir).get(&id) else {
- return Err(WaitError::Unknown);
- };
- if !matches!(record.spec.kind, OrchestrationTaskKind::SubAgent { .. }) {
- return Err(WaitError::Unknown);
- }
- if record_parent_session(&record) != Some(parent_session) {
- return Err(WaitError::NotOwned);
- }
- Ok(record)
-}
-
-pub(crate) fn record_to_status(record: OrchestrationTaskRecord) -> WaitOutcome {
- match record.status {
- OrchestrationTaskStatus::Completed => {
- let output = record
- .result
- .and_then(|result| {
- result
- .text
- .or_else(|| result.output.map(|output| output.to_string()))
- })
- .unwrap_or_default();
- WaitOutcome::Terminal(SubagentStatus::Completed {
- output,
- iterations: 0,
- })
- }
- OrchestrationTaskStatus::Awaiting => WaitOutcome::Terminal(SubagentStatus::AwaitingUser {
- question: record.error.unwrap_or_else(|| {
- "sub-agent is awaiting user input; no clarification text was available from the durable task store".to_string()
- }),
- }),
- OrchestrationTaskStatus::Failed
- | OrchestrationTaskStatus::TimedOut
- | OrchestrationTaskStatus::Abandoned => WaitOutcome::Terminal(SubagentStatus::Failed {
- error: record.error.unwrap_or_else(|| {
- format!(
- "sub-agent reached durable task status `{}`",
- task_status_label(record.status)
- )
- }),
- }),
- OrchestrationTaskStatus::Cancelled => WaitOutcome::Terminal(SubagentStatus::Failed {
- error: "sub-agent was cancelled".to_string(),
- }),
- OrchestrationTaskStatus::Pending
- | OrchestrationTaskStatus::Running
- | OrchestrationTaskStatus::CancelRequested => WaitOutcome::TimedOut(SubagentStatus::Running),
- }
-}
-
-pub(crate) fn task_status_label(status: OrchestrationTaskStatus) -> &'static str {
- match status {
- OrchestrationTaskStatus::Pending => "pending",
- OrchestrationTaskStatus::Running => "running",
- OrchestrationTaskStatus::Awaiting => "awaiting",
- OrchestrationTaskStatus::Completed => "completed",
- OrchestrationTaskStatus::Failed => "failed",
- OrchestrationTaskStatus::CancelRequested => "cancel_requested",
- OrchestrationTaskStatus::Cancelled => "cancelled",
- OrchestrationTaskStatus::TimedOut => "timed_out",
- OrchestrationTaskStatus::Abandoned => "abandoned",
- }
+ subagent_record_for_task(
+ task_store_for_workspace(workspace_dir).as_ref(),
+ task_id,
+ parent_session,
+ )
}
/// Snapshot the typed lifecycle records, optionally scoped to a `parent_session`.
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents_steering_tests.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents_steering_tests.rs
index c459445193..2b6c1e10b1 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents_steering_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents_steering_tests.rs
@@ -29,7 +29,7 @@ async fn steer_pushes_into_the_subagent_queue() {
.unwrap();
assert_eq!(rq.status().await.collects, 1);
- let _ = tx.send(SubagentStatus::Completed {
+ let _ = tx.send(DetachedSubagentStatus::Completed {
output: "done".into(),
iterations: 1,
});
@@ -66,7 +66,7 @@ async fn steer_prefers_registered_tinyagents_handle() {
}
let _ = shared_steering_registry().deregister(&task_id);
- let _ = tx.send(SubagentStatus::Completed {
+ let _ = tx.send(DetachedSubagentStatus::Completed {
output: "done".into(),
iterations: 1,
});
@@ -103,7 +103,7 @@ async fn steer_directive_delivers_control_flow_via_background_policy() {
assert_eq!(commands[1], SteeringCommand::Cancel);
let _ = shared_steering_registry().deregister(&task_id);
- let _ = tx.send(SubagentStatus::Completed {
+ let _ = tx.send(DetachedSubagentStatus::Completed {
output: "done".into(),
iterations: 1,
});
@@ -137,7 +137,7 @@ async fn steer_directive_refuses_kinds_the_policy_rejects() {
assert_eq!(commands, vec![SteeringCommand::Pause]);
let _ = shared_steering_registry().deregister(&task_id);
- let _ = tx.send(SubagentStatus::Completed {
+ let _ = tx.send(DetachedSubagentStatus::Completed {
output: "done".into(),
iterations: 1,
});
@@ -166,7 +166,7 @@ async fn steer_directive_enforces_ownership_and_registration() {
Err(SteerDirectiveError::NoRegisteredHandle)
);
- let _ = tx.send(SubagentStatus::Completed {
+ let _ = tx.send(DetachedSubagentStatus::Completed {
output: "done".into(),
iterations: 1,
});
@@ -207,7 +207,7 @@ async fn steer_after_terminal_is_rejected() {
let _guard = test_guard();
let rq = run_queue();
let tx = register_test("task-term", "session-A", rq);
- let _ = tx.send(SubagentStatus::Failed {
+ let _ = tx.send(DetachedSubagentStatus::Failed {
error: "boom".into(),
});
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents_tests.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents_tests.rs
index d6735d7d58..76b2577529 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents_tests.rs
@@ -75,7 +75,7 @@ fn register_test(
task_id: &str,
parent_session: &str,
rq: Arc<RunQueue<QueuedTurn>>,
-) -> watch::Sender<SubagentStatus> {
+) -> watch::Sender<DetachedSubagentStatus> {
register_test_with_thread(task_id, parent_session, None, rq)
}
@@ -86,7 +86,7 @@ fn register_test_with_thread(
parent_session: &str,
parent_thread_id: Option<&str>,
rq: Arc<RunQueue<QueuedTurn>>,
-) -> watch::Sender<SubagentStatus> {
+) -> watch::Sender<DetachedSubagentStatus> {
let (tx, rx) = status_channel();
register(
task_id.into(),
@@ -121,7 +121,7 @@ async fn task_store_records_spawn_complete_and_cancel() {
);
// Publish a terminal status → the watcher mirrors Completed into the store.
- tx.send(SubagentStatus::Completed {
+ tx.send(DetachedSubagentStatus::Completed {
output: "done".into(),
iterations: 2,
})
@@ -181,7 +181,7 @@ async fn task_id_for_session_enforces_parent_ownership() {
task_id_for_session("subsess-1", "session-other"),
Err(WaitError::NotOwned)
));
- let _ = tx.send(SubagentStatus::Completed {
+ let _ = tx.send(DetachedSubagentStatus::Completed {
output: "done".into(),
iterations: 1,
});
@@ -233,7 +233,7 @@ async fn snapshot_and_block_scope_to_parent_and_reflect_live_status() {
);
// `b` pauses awaiting the user; `a` stays running.
- tx_b.send(SubagentStatus::AwaitingUser {
+ tx_b.send(DetachedSubagentStatus::AwaitingUser {
question: "which repo?".into(),
})
.unwrap();
@@ -344,11 +344,11 @@ async fn snapshot_and_block_scope_to_parent_and_reflect_live_status() {
.is_none());
}
- let _ = tx_a.send(SubagentStatus::Completed {
+ let _ = tx_a.send(DetachedSubagentStatus::Completed {
output: "x".into(),
iterations: 1,
});
- let _ = tx_other.send(SubagentStatus::Completed {
+ let _ = tx_other.send(DetachedSubagentStatus::Completed {
output: "x".into(),
iterations: 1,
});
@@ -386,7 +386,7 @@ async fn resume_ref_for_task_includes_resume_fields_and_enforces_ownership() {
Err(WaitError::NotOwned)
));
- let _ = tx.send(SubagentStatus::Completed {
+ let _ = tx.send(DetachedSubagentStatus::Completed {
output: "done".into(),
iterations: 1,
});
@@ -409,7 +409,7 @@ async fn task_id_for_session_prefers_live_task_over_terminal_task() {
dummy_abort(),
old_rx,
);
- let _ = old_tx.send(SubagentStatus::Completed {
+ let _ = old_tx.send(DetachedSubagentStatus::Completed {
output: "old".into(),
iterations: 1,
});
@@ -442,7 +442,7 @@ async fn wait_returns_completion_once_published() {
let tx = register_test("task-wait", "session-A", rq);
tokio::spawn(async move {
- let _ = tx.send(SubagentStatus::Completed {
+ let _ = tx.send(DetachedSubagentStatus::Completed {
output: "the answer".into(),
iterations: 3,
});
@@ -454,7 +454,7 @@ async fn wait_returns_completion_once_published() {
.await
.expect("wait should resolve");
match outcome {
- WaitOutcome::Terminal(SubagentStatus::Completed { output, iterations }) => {
+ WaitOutcome::Terminal(DetachedSubagentStatus::Completed { output, iterations }) => {
assert_eq!(output, "the answer");
assert_eq!(iterations, 3);
}
@@ -479,7 +479,7 @@ async fn wait_times_out_and_leaves_entry_intact() {
.expect("wait should resolve");
assert!(matches!(
outcome,
- WaitOutcome::TimedOut(SubagentStatus::Running)
+ WaitOutcome::TimedOut(DetachedSubagentStatus::Running)
));
// still steerable after a timed-out wait
@@ -576,7 +576,7 @@ async fn cancel_by_task_flags_a_run_that_already_finished() {
let cases = [
(
"task-cbt-done",
- SubagentStatus::Completed {
+ DetachedSubagentStatus::Completed {
output: "ok".into(),
iterations: 6,
},
@@ -584,14 +584,14 @@ async fn cancel_by_task_flags_a_run_that_already_finished() {
),
(
"task-cbt-failed",
- SubagentStatus::Failed {
+ DetachedSubagentStatus::Failed {
error: "boom".into(),
},
Some(FinishedOutcome::Failed),
),
(
"task-cbt-paused",
- SubagentStatus::AwaitingUser {
+ DetachedSubagentStatus::AwaitingUser {
question: "which?".into(),
},
None,
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents_wire_tests.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents_wire_tests.rs
index 1d8de46121..5aa6f0e359 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents_wire_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents_wire_tests.rs
@@ -50,17 +50,17 @@ async fn roster_status_labels_are_literal() {
for (id, tx) in &senders {
match *id {
"wire-done" => tx
- .send(SubagentStatus::Completed {
+ .send(DetachedSubagentStatus::Completed {
output: "o".into(),
iterations: 1,
})
.unwrap(),
"wire-await" => tx
- .send(SubagentStatus::AwaitingUser {
+ .send(DetachedSubagentStatus::AwaitingUser {
question: "q".into(),
})
.unwrap(),
- "wire-fail" => tx.send(SubagentStatus::Failed { error: "e".into() }).unwrap(),
+ "wire-fail" => tx.send(DetachedSubagentStatus::Failed { error: "e".into() }).unwrap(),
_ => {}
}
}
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_control_tests.rs b/crates/openhuman-core/src/agent/orchestration/subagent_control_tests.rs
index 644528c424..87b5848c50 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_control_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_control_tests.rs
@@ -57,7 +57,7 @@ fn field(out: &Value, name: &str) -> Option<Value> {
#[tokio::test]
async fn cancel_of_a_finished_run_reports_its_outcome_and_rewrites_nothing() {
use crate::agent::orchestration::running_subagents::{
- register, status_channel, SubagentStatus,
+ register, status_channel, DetachedSubagentStatus,
};
use crate::agent::orchestration::subagent_sessions::SubagentSessionStore;
use std::sync::Arc;
@@ -76,7 +76,7 @@ async fn cancel_of_a_finished_run_reports_its_outcome_and_rewrites_nothing() {
for (task_id, status, outcome) in [
(
"sub-rpc-done",
- SubagentStatus::Completed {
+ DetachedSubagentStatus::Completed {
output: "ok".into(),
iterations: 1,
},
@@ -84,7 +84,7 @@ async fn cancel_of_a_finished_run_reports_its_outcome_and_rewrites_nothing() {
),
(
"sub-rpc-failed",
- SubagentStatus::Failed {
+ DetachedSubagentStatus::Failed {
error: "boom".into(),
},
"failed",
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 396d0571b9..7f69e9e803 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
@@ -8,7 +8,7 @@ use super::subagent_abort_report::AbortReport;
use crate::agent::harness::definition::AgentDefinitionRegistry;
use crate::agent::messages::ChatMessage;
use crate::agent::orchestration::fleet_tools::FleetToolSet;
-use crate::agent::orchestration::running_subagents::{self, SubagentStatus};
+use crate::agent::orchestration::running_subagents::{self, DetachedSubagentStatus};
use crate::agent::orchestration::subagent_sessions::{
self, DurableSubagentStatus, SubagentSessionSelector, SubagentSessionStore,
SubagentSessionUpsert,
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 abffab72c8..9108fb30da 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
@@ -459,7 +459,7 @@ impl SpawnAsyncSubagentTool {
err
);
}
- let _ = status_tx.send(SubagentStatus::Completed {
+ let _ = status_tx.send(DetachedSubagentStatus::Completed {
output: outcome.output.clone(),
iterations: outcome.iterations,
});
@@ -544,7 +544,7 @@ impl SpawnAsyncSubagentTool {
Partial progress:\n{}",
outcome.output
);
- let _ = status_tx.send(SubagentStatus::Completed {
+ let _ = status_tx.send(DetachedSubagentStatus::Completed {
output: framed.clone(),
iterations: outcome.iterations,
});
@@ -614,7 +614,7 @@ impl SpawnAsyncSubagentTool {
err
);
}
- let _ = status_tx.send(SubagentStatus::Failed {
+ let _ = status_tx.send(DetachedSubagentStatus::Failed {
error: error.clone(),
});
crate::agent::orchestration::background_completions::record_failure(
@@ -660,7 +660,7 @@ impl SpawnAsyncSubagentTool {
err
);
}
- let _ = status_tx.send(SubagentStatus::AwaitingUser {
+ let _ = status_tx.send(DetachedSubagentStatus::AwaitingUser {
question: question.clone(),
});
// #4896: a detached child that pauses for input won't
@@ -715,7 +715,7 @@ impl SpawnAsyncSubagentTool {
store_err
);
}
- let _ = status_tx.send(SubagentStatus::Failed {
+ let _ = status_tx.send(DetachedSubagentStatus::Failed {
error: error.clone(),
});
// #4896: a detached child that errors previously only
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs b/crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs
index da0557f9bd..6dada7513c 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs
@@ -9,7 +9,7 @@ use std::time::Duration;
use crate::agent::harness::fork_context::ParentExecutionContext;
use crate::agent::orchestration::running_subagents::{
- self, SubagentStatus, WaitError, WaitOutcome,
+ self, DetachedSubagentStatus, WaitError, WaitOutcome,
};
use async_trait::async_trait;
use serde_json::json;
@@ -229,7 +229,7 @@ impl WaitSubagentTool {
)
.await
{
- Ok(WaitOutcome::Terminal(SubagentStatus::Completed { output, iterations })) => {
+ Ok(WaitOutcome::Terminal(DetachedSubagentStatus::Completed { output, iterations })) => {
log::debug!(
"[wait_subagent] outcome=completed task_id={} iterations={}",
resolved_task_id,
@@ -259,7 +259,7 @@ impl WaitSubagentTool {
serde_json::to_string(&status).unwrap_or_else(|_| "{}".to_string())
)))
}
- Ok(WaitOutcome::Terminal(SubagentStatus::AwaitingUser { question })) => {
+ Ok(WaitOutcome::Terminal(DetachedSubagentStatus::AwaitingUser { question })) => {
log::debug!(
"[wait_subagent] outcome=awaiting_user task_id={} question_chars={}",
resolved_task_id,
@@ -299,7 +299,7 @@ impl WaitSubagentTool {
}
Ok(ToolResult::success(message))
}
- Ok(WaitOutcome::Terminal(SubagentStatus::Failed { error })) => {
+ Ok(WaitOutcome::Terminal(DetachedSubagentStatus::Failed { error })) => {
log::debug!(
"[wait_subagent] outcome=failed task_id={} error={}",
resolved_task_id,
@@ -320,7 +320,7 @@ impl WaitSubagentTool {
)))
}
// `Running` is never terminal; treat defensively as a timeout-style result.
- Ok(WaitOutcome::Terminal(SubagentStatus::Running)) => {
+ Ok(WaitOutcome::Terminal(DetachedSubagentStatus::Running)) => {
log::debug!(
"[wait_subagent] outcome=running task_id={} timeout_secs={}",
resolved_task_id,