Skip to content

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

refactor(subagent_host): move resume history helper into lifecycle

Steven Enamakel5118aa368026
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents.rs
index 2088d157e5..07b16b6d0b 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents.rs
@@ -74,11 +74,9 @@ pub(crate) use registry::admit_spawn;
#[cfg(test)]
pub(crate) use registry::{RegistrationError, register, status_channel};
pub(crate) use roster::active_subagents_context_block;
-pub use steering::steer;
pub(crate) use steering::steer_control;
#[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, task_store_for_workspace,
};
-pub(crate) use wait::wait_in_workspace;
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/subagent_control_surfaces.rs b/crates/openhuman-core/src/agent/orchestration/tools/subagent_control_surfaces.rs
index a916ca5036..9e85144460 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/subagent_control_surfaces.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/subagent_control_surfaces.rs
@@ -11,7 +11,6 @@ use serde_json::{Value, json};
use tinyagents_orchestration::subagent::SubagentResumeRef;
use tinytools::{PermissionLevel, Tool, ToolResult, ToolTimeout};
-use crate::agent::orchestration::subagent_sessions;
use crate::agent::orchestration::subagent_sessions::{
DurableSubagentSessionSummary, DurableSubagentStatus,
};
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
index 4d9e953e35..4ac76f9d8b 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
@@ -34,7 +34,9 @@ mod checkpoint;
mod outcome;
use checkpoint::absolute_checkpoint_dir;
use driver_adapter::HostInvocation;
+pub(super) use driver_adapter::outcome_to_host;
use outcome::HostInFlightMap;
+pub(super) use persistence::OpenHumanPersistence;
use super::{
SubagentRunError, SubagentRunOptions, SubagentRunOutcome, SubagentRunStatus, SubagentUsage,
@@ -114,6 +116,14 @@ pub async fn continue_subagent(
continue_subagent_with_parent(&root, original_key, definition.clone(), input, options).await
}
+/// Appends the continuation input after the durable conversation history.
+pub(super) fn merged_resume_history(mut history: Vec<Message>, input: String) -> Vec<Message> {
+ if !input.is_empty() {
+ history.push(Message::user(input));
+ }
+ history
+}
+
/// Runs a host-prepared subagent through TinyAgents' registered driver
/// dispatcher and shared Jobs/Message registry. Product preflight and result
/// delivery stay with the caller; the generic driver owns child registration,
@@ -923,6 +933,8 @@ impl OpenHumanSubagentHost {
}
}
+#[path = "lifecycle/driver_adapter.rs"]
+mod driver_adapter;
/// One configured OpenHuman lifecycle driver and its request-keyed host
/// projections. Keeping this factory separate lets registered TinyAgents
/// dispatchers reuse the same planner, executor and persistence adapters
@@ -930,14 +942,8 @@ impl OpenHumanSubagentHost {
/// second generic driver).
#[path = "lifecycle/persistence.rs"]
mod persistence;
-pub(super) use persistence::OpenHumanPersistence;
-#[path = "lifecycle/driver_adapter.rs"]
-mod driver_adapter;
-
-pub(super) use driver_adapter::{
- HostRequest, OpenHumanDriverBundle, merged_resume_history, outcome_to_host,
-};
+pub(super) use driver_adapter::{HostRequest, OpenHumanDriverBundle};
fn map_lifecycle_error(error: SubagentError) -> SubagentRunError {
SubagentRunError::Provider(anyhow::anyhow!(error.to_string()))
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_adapter.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_adapter.rs
index fe91ef6f6f..338230cee1 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_adapter.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_adapter.rs
@@ -82,19 +82,6 @@ struct OpenHumanPlanner {
plans: Arc<Mutex<HashMap<SubagentTaskKey, PreparedHostPlan>>>,
}
-/// Appends the new continuation input to the exact durable history supplied by
-/// TinyAgents. Kept separate so the no-drop/no-duplicate resume contract has a
-/// focused regression test independent of provider execution.
-pub(in crate::agent::subagent_host) fn merged_resume_history(
- mut history: Vec<Message>,
- input: String,
-) -> Vec<Message> {
- if !input.is_empty() {
- history.push(Message::user(input));
- }
- history
-}
-
#[async_trait]
impl SubagentPlanner<crate::agent::tinyagents::host::OpenHumanRunContext, HostRequest>
for OpenHumanPlanner
@@ -114,7 +101,7 @@ impl SubagentPlanner<crate::agent::tinyagents::host::OpenHumanRunContext, HostRe
// after that durable history, exactly once; never overwrite a
// caller-provided answer with the loaded checkpoint.
let planned_input = if let Some(resume) = request.resume {
- let history = merged_resume_history(resume.history, input);
+ let history = super::merged_resume_history(resume.history, input);
options.initial_history = Some(
history
.iter()