Skip to content

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

refactor(agent): move worker thread tool out of orchestration

Steven Enamakelbffc230edc95
diff --git a/crates/openhuman-core/src/agent/orchestration/tools.rs b/crates/openhuman-core/src/agent/orchestration/tools.rs
index 3dcd73a96e..50a7d17f4b 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools.rs
@@ -4,15 +4,15 @@
//!
//! Tools, by role:
//! - **Spawn**: `spawn_subagent`, `spawn_async_subagent`,
-//! `spawn_parallel_agents`, `spawn_worker_thread` (in `tools::impl::threads`).
+//! `spawn_parallel_agents`.
//! - **Control**: `steer_subagent`, `continue_subagent`, `close_subagent`,
//! `wait_subagent`, `wait` / `wait_loop`, `list_subagents`.
//! - **Delegation**: `DelegateGraphTool`, `ArchetypeDelegationTool`,
//! and `CollapsedDelegationTool` (`delegate_to`).
//!
-//! `dispatch.rs`, `awaiting_user.rs`, and `worker_thread.rs` are `pub(crate)`
-//! helpers shared by the tools above (the common spawn path, the awaiting-user
-//! envelope, and worker thread creation), not tools themselves.
+//! `dispatch.rs` and `awaiting_user.rs` are `pub(crate)` helpers shared by the
+//! tools above (the common spawn path and awaiting-user envelope), not tools
+//! themselves. Worker-thread persistence lives in `threads`.
//!
//! `agent::registration` assembles the delegation tools for the catalogue.
//! Execution itself goes through
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph.rs
index b52e8c9169..dd0a5f3728 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph.rs
@@ -50,7 +50,7 @@ pub(super) use dispatch::run_subagent_via_graph;
// Only what `graph_tests.rs`'s `use super::*` still needs directly (the rest
// of the original flat imports now live with the code that uses them, in
-// `dispatch.rs` / `transcript.rs` / `worker_mirror.rs`).
+// `dispatch.rs` / `transcript.rs` / `threads::worker_mirror`).
#[cfg(test)]
use crate::agent::progress::AgentProgress;
#[cfg(test)]
diff --git a/crates/openhuman-core/src/memory/README.md b/crates/openhuman-core/src/memory/README.md
index dfee63ec03..c22fdb61c7 100644
--- a/crates/openhuman-core/src/memory/README.md
+++ b/crates/openhuman-core/src/memory/README.md
@@ -113,7 +113,7 @@ user message
session host prelude ----> prefetch::pre_turn
(agent/session_host/ takes a completed cached TurnPack (or none)
runtime_session/ queues user log (index 2n), recall and
- memory_ingest.rs) optional date hint in a scoped worker
+ session_hooks.rs) optional date hint in a scoped worker
v
MemoryPackMiddleware ----> adds the pack to each model request of the
(agent/tinyagents/ turn as an ephemeral instruction; it is
diff --git a/crates/openhuman-core/src/plan_review/gate.rs b/crates/openhuman-core/src/plan_review/gate.rs
index 66c0bc601d..247d47b1bf 100644
--- a/crates/openhuman-core/src/plan_review/gate.rs
+++ b/crates/openhuman-core/src/plan_review/gate.rs
@@ -193,10 +193,7 @@ impl PlanReviewGate {
let scope = tenant.profile_only();
let key = (scope.clone(), thread_id.to_string());
let request_id = self.thread_to_request.lock().get(&key)?.clone();
- self.parked
- .lock()
- .get(&(scope, request_id))
- .cloned()
+ self.parked.lock().get(&(scope, request_id)).cloned()
}
/// Resolve a parked review by `request_id`. Returns `true` when a waiter was
diff --git a/crates/openhuman-core/src/tools/orchestrator_tools.rs b/crates/openhuman-core/src/tools/orchestrator_tools.rs
index 36642a2d4e..55994c9f69 100644
--- a/crates/openhuman-core/src/tools/orchestrator_tools.rs
+++ b/crates/openhuman-core/src/tools/orchestrator_tools.rs
@@ -42,7 +42,7 @@ use tinyagents_definition::SubagentEntry;
use crate::agent::orchestration::tools::ArchetypeDelegationTool;
use crate::agent::orchestration::tools::DelegationTarget;
#[allow(unused_imports)]
-use crate::agent::orchestration::tools::SpawnWorkerThreadTool;
+use crate::tools::r#impl::threads::SpawnWorkerThreadTool;
use tinytools::Tool;
/// Synthesise the delegation tool list for an agent based on its
diff --git a/scripts/ci/process-statics.json b/scripts/ci/process-statics.json
index 2387e100c5..e7a14f1f51 100644
--- a/scripts/ci/process-statics.json
+++ b/scripts/ci/process-statics.json
@@ -186,7 +186,7 @@
"type": "OnceLock<PlanReviewGate>",
"count": 1,
"category": "B",
- "reason": "The process gate is infrastructure, and its waiter, parked-review, and thread lookup tables are keyed by the authenticated Tenant plus request/thread id; a decision or replay lookup in one tenant cannot reach another tenant's parked plan.",
+ "reason": "The process gate is infrastructure, and its waiter, parked-review, and thread lookup tables use the profile-only tenant key plus request/thread id; agent requests remain available to their profile-level UI while other profiles cannot reach them.",
"verification": "plan_review/gate_tests.rs: parked_reviews_are_isolated_by_tenant"
},
{
diff --git a/vendor/tinyagents b/vendor/tinyagents
index b817766b69..fc698b1584 160000
--- a/vendor/tinyagents
+++ b/vendor/tinyagents
@@ -1 +1 @@
-Subproject commit b817766b6914a92921fb40181e887c0505d2ae71
+Subproject commit fc698b15848bc68cea398d370d6fa0eb2d0f67ae