Skip to content

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

style: format subagent host exports and add run context test

Steven Enamakelac1d506c1851
diff --git a/crates/openhuman-core/src/agent/subagent_host/mod.rs b/crates/openhuman-core/src/agent/subagent_host/mod.rs
index 94a6affe16..ba0407fc99 100644
--- a/crates/openhuman-core/src/agent/subagent_host/mod.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/mod.rs
@@ -54,9 +54,7 @@ mod lifecycle_tests;
mod persisted_compat_tests;
// Public API — the entry point and the shapes it returns.
-pub use autonomous::{
- subagent_iter_cap_with_autonomous_lift,
-};
+pub use autonomous::subagent_iter_cap_with_autonomous_lift;
pub(crate) use lifecycle::load_subagent_checkpoint;
pub use lifecycle::{
continue_subagent, continue_subagent_with_parent, run_subagent, run_subagent_with_parent,
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
index b6fd8b00e9..b54b1b58b3 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs
@@ -927,9 +927,9 @@ async fn run_typed_mode(
filtered_specs.clone(),
allowed_names,
subagent_iter_cap_with_autonomous_lift(
- options.run_context.autonomous_iter_cap,
- definition.effective_max_iterations(),
- ),
+ options.run_context.autonomous_iter_cap,
+ definition.effective_max_iterations(),
+ ),
options.run_queue.clone(),
parent.on_progress.clone(),
&definition.id,
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs
index f563962270..df9895798d 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs
@@ -458,3 +458,16 @@ fn a_response_shape_belongs_to_the_root_turn_and_is_not_inherited() {
assert!(root.child().response_shape.is_none());
assert!(root.response_shape.is_some());
}
+
+#[test]
+fn autonomous_iter_cap_is_inherited_by_children_and_lifts_subagent_caps() {
+ use crate::agent::subagent_host::subagent_iter_cap_with_autonomous_lift as lift;
+ let mut parent = OpenHumanRunContext::new();
+ assert_eq!(parent.child().autonomous_iter_cap, None);
+ assert_eq!(lift(parent.autonomous_iter_cap, 10), 10);
+ parent.autonomous_iter_cap = Some(200);
+ let grandchild = parent.child().child();
+ assert_eq!(grandchild.autonomous_iter_cap, Some(200));
+ assert_eq!(lift(grandchild.autonomous_iter_cap, 10), 200);
+ assert_eq!(lift(Some(5), 10), 10, "a cap below the base never lowers it");
+}