Skip to content

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

refactor(subagent-host): inline root context helper

Steven Enamakele1cc4b3d127b
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
index 25580ff92b..2fe3377de5 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle.rs
@@ -35,14 +35,6 @@ use super::{
SubagentRunError, SubagentRunOptions, SubagentRunOutcome, SubagentRunStatus, SubagentUsage,
};
-fn root_context_from_options(
- options: &SubagentRunOptions,
-) -> crate::agent::tinyagents::host::OpenHumanRunContext {
- // The parent lineage is exactly what the caller put on the explicit
- // carrier (`run_context.parent`); nothing is re-bound from an ambient turn.
- options.run_context.clone()
-}
-
/// Runs one host subagent through a neutral driver using a real direct child.
///
/// Callers that are already inside a TinyAgents turn must use this entrypoint:
@@ -66,7 +58,7 @@ pub async fn run_subagent(
input: &str,
options: SubagentRunOptions,
) -> Result<SubagentRunOutcome, SubagentRunError> {
- let mut root_data = root_context_from_options(&options);
+ let mut root_data = options.run_context.clone();
let root_config = root_data.root_run_config("subagent-host");
let root = root_data.into_tinyagents(root_config);
run_subagent_with_parent(&root, definition.clone(), input, options).await
@@ -95,7 +87,7 @@ pub async fn continue_subagent(
input: &str,
options: SubagentRunOptions,
) -> Result<SubagentRunOutcome, SubagentRunError> {
- let mut root_data = root_context_from_options(&options);
+ let mut root_data = options.run_context.clone();
let root_config = root_data.root_run_config("subagent-host");
let root = root_data.into_tinyagents(root_config);
continue_subagent_with_parent(&root, original_key, definition.clone(), input, options).await
diff --git a/scripts/ci/check-openhuman-rust-layout.mjs b/scripts/ci/check-openhuman-rust-layout.mjs
index 11d8076923..cdccfb9135 100644
--- a/scripts/ci/check-openhuman-rust-layout.mjs
+++ b/scripts/ci/check-openhuman-rust-layout.mjs
@@ -44,7 +44,7 @@ const LEGACY_LIMIT_ENTRIES = [
["crates/openhuman-core/src/core/all_tests.rs", 1465],
["crates/openhuman-core/src/core/events.rs", 1803],
["crates/openhuman-core/src/core/events_tests.rs", 997],
- ["crates/openhuman-core/src/core/observability.rs", 3430],
+ ["crates/openhuman-core/src/core/observability.rs", 3429],
];
const LEGACY_LIMITS = new Map(LEGACY_LIMIT_ENTRIES);