Skip to content

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

refactor(threads): move worker mirror helpers to the threads module

Steven Enamakel305130a1f4de
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
index 9f9955369b..a5676fa505 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
@@ -1,4 +1,5 @@
-use super::{ArchetypeDelegationTool, DelegationTarget, SpawnSubagentTool, SpawnWorkerThreadTool};
+use super::{ArchetypeDelegationTool, DelegationTarget, SpawnSubagentTool};
+use crate::tools::impl::threads::SpawnWorkerThreadTool;
use crate::agent::harness::ParentExecutionContext;
use crate::integrations::ConnectedIntegration;
use crate::agent_registry::host_definition::AgentDefinitionRegistry;
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 bcf7e263cc..b52e8c9169 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph.rs
@@ -54,6 +54,8 @@ pub(super) use dispatch::run_subagent_via_graph;
#[cfg(test)]
use crate::agent::progress::AgentProgress;
#[cfg(test)]
+use crate::threads::worker_mirror::{mirror_worker_thread, mirror_worker_thread_from_history};
+#[cfg(test)]
use std::collections::HashSet;
#[cfg(test)]
use std::sync::Arc;
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
index da54edc8e7..7aeb647ddc 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs
@@ -17,7 +17,7 @@ use tinytools::{Tool, ToolSpec};
use tinytools_agent::dialect::TranscriptEntry;
use super::transcript::persist_subagent_transcript;
-use super::worker_mirror::mirror_worker_thread;
+use crate::threads::worker_mirror::mirror_worker_thread;
/// Cumulative usage stats gathered across a sub-agent graph run.
#[derive(Debug, Clone, Default)]
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs
index 1be7e237c2..87ed813698 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs
@@ -9,7 +9,7 @@ use crate::agent::tinyagents::host::OpenHumanRunContext;
use tinyagents_session::transcript::{TranscriptLocator, TranscriptMessage, TranscriptTurn};
use super::dispatch::AggregatedUsage;
-use super::worker_mirror::mirror_worker_thread_from_history;
+use crate::threads::worker_mirror::mirror_worker_thread_from_history;
/// The history a failed sub-agent run persists, plus the unanswered steps as
/// text (#6281).
diff --git a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
index 50592dde35..068be51f72 100644
--- a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
@@ -20,8 +20,9 @@ use tinytools::ToolRunContext;
use crate::agent::orchestration::tools::{
CloseSubagentDispatch, ContinueSubagentDispatch, DelegateGraphDispatch, DelegationDispatch,
ListSubagentsDispatch, SpawnAsyncSubagentDispatch, SpawnParallelAgentsDispatch,
- SpawnSubagentDispatch, SpawnWorkerThreadDispatch, SteerSubagentDispatch, WaitSubagentDispatch,
+ SpawnSubagentDispatch, SteerSubagentDispatch, WaitSubagentDispatch,
};
+use crate::tools::impl::threads::SpawnWorkerThreadDispatch;
use crate::agent::tinyagents::host::OpenHumanRunContext;
use crate::agent::tinyagents::host::run_context::HostOperationContext;
use crate::agent::tinyagents::turn_policy::is_subagent_spawn_or_delegate_tool;
diff --git a/crates/openhuman-core/src/threads/worker_mirror.rs b/crates/openhuman-core/src/threads/worker_mirror.rs
index ed6896bfdb..2e1f99dc7a 100644
--- a/crates/openhuman-core/src/threads/worker_mirror.rs
+++ b/crates/openhuman-core/src/threads/worker_mirror.rs
@@ -71,7 +71,7 @@ fn append_worker_message(
/// Each message carries the restored legacy metadata (#4466): a per-round
/// `iteration` counter, `final` on the trailing message, `tool_calls` on an
/// assistant round, and `tool_call_id` / `tool_name` on each tool result.
-pub(super) fn mirror_worker_thread(
+pub(crate) fn mirror_worker_thread(
ctx: &DispatchCtx,
workspace_dir: &std::path::Path,
thread_id: &str,
@@ -182,7 +182,7 @@ pub(super) fn mirror_worker_thread(
/// `user` rows. Used when only the recovered snapshot (not the typed
/// `conversation`) is available. `failure_final`, when set, is appended as a
/// trailing `agent` failure marker.
-pub(super) fn mirror_worker_thread_from_history(
+pub(crate) fn mirror_worker_thread_from_history(
ctx: &DispatchCtx,
workspace_dir: &std::path::Path,
thread_id: &str,
diff --git a/scripts/ci/process-statics.json b/scripts/ci/process-statics.json
index 2e8d9b7572..2387e100c5 100644
--- a/scripts/ci/process-statics.json
+++ b/scripts/ci/process-statics.json
@@ -197,7 +197,7 @@
"count": 1,
"category": "D",
"reason": "The installed provider is a routing handle to the session storage backend; callers select AgentStores with the authenticated tenant's session_key, and durable records remain in the backend.",
- "verification": "storage/sessions/mod_tests.rs: a_profile_prefixed_key_round_trips_through_edit_and_regenerate"
+ "verification": "storage/sessions/mod_tests.rs: two_profiles_default_agents_keep_separate_session_keys_and_stores; threads/ops/edit_tests.rs: a_profile_prefixed_key_round_trips_through_edit_and_regenerate"
},
{
"file": "crates/openhuman-core/src/storage/sessions/workspace.rs",
@@ -207,7 +207,7 @@
"count": 1,
"category": "D",
"reason": "Each entry routes one workspace path to its storage backend and DriverSessionStores provider; returned stores still require the caller's tenant session key, while authoritative session data remains in the backend.",
- "verification": "storage/sessions/mod_tests.rs: each_workspace_keeps_its_sessions_in_its_own_database; storage/sessions/mod_tests.rs: a_profile_prefixed_key_round_trips_through_edit_and_regenerate"
+ "verification": "storage/sessions/mod_tests.rs: each_workspace_keeps_its_sessions_in_its_own_database; storage/sessions/mod_tests.rs: two_profiles_default_agents_keep_separate_session_keys_and_stores; threads/ops/edit_tests.rs: a_profile_prefixed_key_round_trips_through_edit_and_regenerate"
},
{
"file": "crates/openhuman-core/src/storage/sessions/workspace.rs",
@@ -217,7 +217,7 @@
"count": 1,
"category": "D",
"reason": "The in-memory provider is a workspace-keyed fallback routing handle; its AgentStores are selected with the caller's tenant session key, and an unusable workspace cannot read another workspace's provider.",
- "verification": "storage/sessions/workspace_tests.rs: an_unusable_workspace_degrades_to_an_in_memory_store; storage/sessions/mod_tests.rs: a_profile_prefixed_key_round_trips_through_edit_and_regenerate"
+ "verification": "storage/sessions/workspace_tests.rs: an_unusable_workspace_degrades_to_an_in_memory_store; storage/sessions/mod_tests.rs: two_profiles_default_agents_keep_separate_session_keys_and_stores; threads/ops/edit_tests.rs: a_profile_prefixed_key_round_trips_through_edit_and_regenerate"
},
{
"file": "crates/openhuman-core/src/triage/evaluator/chain.rs",
diff --git a/vendor/tinyagents b/vendor/tinyagents
index 6b7de0cb96..3b4d2a9119 160000
--- a/vendor/tinyagents
+++ b/vendor/tinyagents
@@ -1 +1 @@
-Subproject commit 6b7de0cb96b27c0cdeea1775ce2d8a1cb18a8a3c
+Subproject commit 3b4d2a9119f52d8ff7f545c05502b1bac13b4a45