Skip to content

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

Merge upstream/main into w5-subagents; repin vendor to merged module mains

Steven Enamakelf21c4efe4684
diff --cc crates/openhuman-app/Cargo.lock
index 70662f411d,8657df0f1b..0945ad691c
--- a/crates/openhuman-app/Cargo.lock
+++ b/crates/openhuman-app/Cargo.lock
@@@ -7696,7 -7801,7 +7696,7 @@@ dependencies =
[[package]]
name = "tinymemory"
- version = "1.20.0"
-version = "1.18.0"
++version = "1.21.0"
dependencies = [
"anyhow",
"async-trait",
diff --cc crates/openhuman-core/src/agent/orchestration/running_subagents/resolve.rs
index 2f52bcbb15,9cb34b70dc..b0cd01981d
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/resolve.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/resolve.rs
@@@ -59,6 -31,6 +31,7 @@@ pub(crate) fn task_id_for_session_in_wo
match task_id_for_session(subagent_session_id, parent_session) {
Ok(task_id) => return Ok(task_id),
Err(WaitError::NotOwned) => return Err(WaitError::NotOwned),
++ Err(WaitError::RegistryPoisoned) => return Err(WaitError::RegistryPoisoned),
Err(WaitError::Unknown) => {}
}
@@@ -111,6 -63,6 +64,7 @@@ pub(crate) fn resume_ref_for_task_in_wo
match resume_ref_for_task(task_id, parent_session) {
Ok(reference) => return Ok(reference),
Err(WaitError::NotOwned) => return Err(WaitError::NotOwned),
++ Err(WaitError::RegistryPoisoned) => return Err(WaitError::RegistryPoisoned),
Err(WaitError::Unknown) => {}
}
diff --cc crates/openhuman-core/src/agent/orchestration/running_subagents/roster.rs
index 8d094a0356,90d61d4f50..468d9b2112
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/roster.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/roster.rs
@@@ -1,56 -1,15 +1,18 @@@
- //! Read-only rosters over the sub-agent registry: a compact snapshot type for
- //! ambient prompt injection, and the durable+live merge used to render the
+ //! Read-only rosters over the sub-agent registry: the durable+live merge used to render the
//! `[active_subagents]` context block.
- use super::registry::{registry, SubagentStatus};
- use crate::agent::orchestration::fleet_tools::FleetToolSet;
+ use tinyagents_orchestration::subagent::{snapshot_for_owner, SubagentSnapshot};
- /// Compact, read-only view of one registered sub-agent, for ambient injection
- /// into a parent's turn context (see [`active_subagents_context_block`]).
- #[derive(Debug, Clone)]
- pub(crate) struct SubagentSnapshot {
- /// Worker *type* (e.g. `code_executor`). Not unique — two parallel workers
- /// share this; disambiguate on `subagent_session_id` / `task_id`.
- pub(crate) agent_id: String,
- /// Durable, stable per-worker reference the prompt steers/waits/closes by.
- pub(crate) subagent_session_id: Option<String>,
- /// Transient registry key.
- pub(crate) task_id: String,
- /// Stable status label: `running` / `awaiting_user` / `completed` / `failed`.
- pub(crate) status: &'static str,
- }
+ use super::registry::registry;
+ use crate::agent::orchestration::fleet_tools::FleetToolSet;
/// Snapshot the sub-agents registered under `parent_session`, with each status
- /// read live from its watch channel. Read-only: it takes the registry lock only
- /// long enough to clone out the small summaries, never blocks on a child, and
- /// never mutates the table. Ordered by `agent_id` then `task_id` so the rendered
- /// roster is stable across turns (the underlying map is unordered).
+ /// read live from its watch channel (ordered by `agent_id` then `task_id`).
pub(crate) fn snapshot_for_parent(parent_session: &str) -> Vec<SubagentSnapshot> {
- let mut out: Vec<SubagentSnapshot> = registry()
- .snapshots(Some(parent_session))
- .expect("detached task registry lock poisoned")
- .into_iter()
- .map(|entry| {
- let status = match &entry.status {
- SubagentStatus::Running => "running",
- SubagentStatus::Completed { .. } => "completed",
- SubagentStatus::AwaitingUser { .. } => "awaiting_user",
- SubagentStatus::Failed { .. } => "failed",
- };
- SubagentSnapshot {
- agent_id: entry.metadata.agent_id,
- subagent_session_id: entry.metadata.subagent_session_id,
- task_id: entry.task_id.as_str().to_string(),
- status,
- }
- })
- .collect();
- out.sort_by(|a, b| {
- a.agent_id
- .cmp(&b.agent_id)
- .then_with(|| a.task_id.cmp(&b.task_id))
- });
- out
- snapshot_for_owner(registry(), parent_session)
++ snapshot_for_owner(registry(), parent_session).unwrap_or_else(|err| {
++ log::warn!("[running_subagents] roster unavailable parent_session={parent_session} err={err:?}");
++ Vec::new()
++ })
}
/// The follow-up guidance sentence, built from the tools the parent can see.
diff --cc crates/openhuman-core/src/agent/orchestration/running_subagents/wait.rs
index 83035b58d5,a8ef890be8..aa35fabca9
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/wait.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/wait.rs
@@@ -65,6 -30,6 +30,7 @@@ pub(crate) async fn wait_in_workspace
match wait(task_id, parent_session, timeout).await {
Ok(outcome) => return Ok(outcome),
Err(WaitError::NotOwned) => return Err(WaitError::NotOwned),
++ Err(WaitError::RegistryPoisoned) => return Err(WaitError::RegistryPoisoned),
Err(WaitError::Unknown) => {}
}
diff --cc crates/openhuman-core/src/agent/orchestration/tools/list_subagents.rs
index 795d8181aa,4cdc1d07a9..8e0edfa11a
--- a/crates/openhuman-core/src/agent/orchestration/tools/list_subagents.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/list_subagents.rs
@@@ -163,8 -163,8 +163,15 @@@ fn overlay_task_store_status
parent_session,
) {
Ok(record) => record,
- Err(running_subagents::WaitError::Unknown) => return,
- Err(running_subagents::WaitError::NotOwned) => {
+ Err(tinyagents_orchestration::subagent::WaitError::Unknown) => return,
++ Err(tinyagents_orchestration::subagent::WaitError::RegistryPoisoned) => {
++ log::warn!(
++ "[subagent_reuse] task store overlay skipped task_id={} reason=registry_poisoned",
++ task_id
++ );
++ return;
++ }
+ Err(tinyagents_orchestration::subagent::WaitError::NotOwned) => {
log::warn!(
"[subagent_reuse] task store overlay rejected task_id={} subagent_session_id={} reason=not_owned",
task_id,
diff --cc crates/openhuman-core/src/agent/orchestration/tools/steer_subagent.rs
index f3d4851bf5,255268cf91..c32d79d9b8
--- a/crates/openhuman-core/src/agent/orchestration/tools/steer_subagent.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/steer_subagent.rs
@@@ -173,6 -173,6 +173,11 @@@ impl SteerSubagentTool
"steer_subagent: sub-agent session `{subagent_session_id}` was not started by this agent."
)));
}
++ Err(tinyagents_orchestration::subagent::WaitError::RegistryPoisoned) => {
++ return Ok(ToolResult::error(
++ "steer_subagent: the sub-agent registry is unavailable; try again.".to_string(),
++ ));
++ }
}
} else {
task_id.clone()
diff --cc crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs
index da0557f9bd,09ff6febce..e10e33742b
--- a/crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs
@@@ -198,6 -199,6 +199,11 @@@ impl WaitSubagentTool
"wait_subagent: sub-agent session `{subagent_session_id}` was not started by this agent."
)));
}
++ Err(WaitError::RegistryPoisoned) => {
++ return Ok(ToolResult::error(
++ "wait_subagent: the sub-agent registry is unavailable; try again.".to_string(),
++ ));
++ }
}
} else {
task_id.clone()
@@@ -361,6 -362,6 +367,15 @@@
"wait_subagent: that sub-agent was not started by this agent.".to_string(),
))
}
++ Err(WaitError::RegistryPoisoned) => {
++ log::warn!(
++ "[wait_subagent] outcome=registry_poisoned task_id={}",
++ resolved_task_id
++ );
++ Ok(ToolResult::error(
++ "wait_subagent: the sub-agent registry is unavailable; try again.".to_string(),
++ ))
++ }
}
}
}
diff --cc vendor/tinyagents
index e1596dad9f,5311c72c80..b88a2728b3
--- a/vendor/tinyagents
+++ b/vendor/tinyagents
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit e1596dad9f2906757b15ab81f57189bf84d238f5
-Subproject commit 5311c72c802d1b6f0bd447aa4a157735dd9bd2b3
++Subproject commit b88a2728b34af96cf79883d5920f82d6068d96b7