Skip to content

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

Merge remote-tracking branch 'refs/remotes/upstream/main' into pr/6350

Steven Enamakel647c50aa289d
diff --cc crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
index ea42a51aa5,1b96eed551..85d0d43811
--- a/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
@@@ -135,8 -137,13 +137,13 @@@ pub(super) fn parse_model_call_wall_clo
/// routes (chat→burst, reasoning→agentic, …) the way the harness registry can.
pub(crate) fn run_policy_for(max_iterations: usize, response_cache_enabled: bool) -> RunPolicy {
let mut policy = RunPolicy::default();
+ // A managed streaming response can finish with reasoning but no visible
+ // answer. Reissue that unusable call once; the harness keeps the same
+ // output cap and drops the blank assistant row before retrying. If it
+ // repeats, the existing EmptyProviderResponse path remains actionable.
+ policy.empty_response_retries = 1;
policy.limits.max_model_calls = max_iterations;
- policy.limits.max_tool_calls = max_iterations.saturating_mul(8).max(8);
+ policy.limits.max_tool_calls = crate::agent::stop_hooks::tool_call_limit(max_iterations);
policy.limits.max_depth = MAX_SPAWN_DEPTH;
// Wall-clock ceiling for the whole turn (issue #4746). The harness bounds
// every individual model AND tool call by the run's *remaining* wall-clock
@@@ -261,15 -296,8 +296,12 @@@ pub(crate) fn effective_max_iterations(
/// put a registry lookup on the per-tool registration loop, so the caller
/// stays responsible for the override names: every path that feeds `allowed`
/// runs `is_subagent_spawn_tool` first, including the dynamic per-spawn tools
- /// (`subagent_runner::ops::runner`). Widen this predicate in lockstep if that
+ /// (`subagent_host::ops::runner`). Widen this predicate in lockstep if that
/// ever stops being true.
pub(crate) fn is_subagent_spawn_or_delegate_tool(name: &str) -> bool {
- name == "spawn_subagent"
- || name.starts_with("delegate_")
- || name == "agent_prepare_context"
- || name == "spawn_worker_thread"
+ name == "spawn_subagent" || name.starts_with("delegate_") || name == "spawn_worker_thread"
}
+
+#[cfg(test)]
+#[path = "turn_policy_budget_tests.rs"]
+mod budget_tests;
diff --cc crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
index d03ad694e0,783d773b69..5430512185
--- a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
@@@ -316,9 -333,17 +333,17 @@@ async fn run_turn_via_tinyagents_inner
);
}
- let mut config = RunConfig::new("agent_turn")
+ // The hosted graph is the execution boundary of the same root turn the
+ // runtime/session already created. Retain that root config id here instead
+ // of manufacturing a second literal `agent_turn` root.
+ let mut config = run_context
+ .root_run_config(if subagent_scope.is_some() {
+ "openhuman-subagent"
+ } else {
+ "openhuman-agent-turn"
+ })
.with_max_model_calls(max_iterations)
- .with_max_tool_calls(max_iterations.saturating_mul(8).max(8))
+ .with_max_tool_calls(crate::agent::stop_hooks::tool_call_limit(max_iterations))
.with_max_depth(MAX_SPAWN_DEPTH)
.with_tag("openhuman")
.with_tag(if subagent_scope.is_some() {
diff --cc crates/openhuman-core/src/flows/ops/run_rows.rs
index 55598c28cd,acc8524626..8a75eadd09
--- a/crates/openhuman-core/src/flows/ops/run_rows.rs
+++ b/crates/openhuman-core/src/flows/ops/run_rows.rs
@@@ -255,8 -256,8 +256,7 @@@ pub(super) fn settle_steps(config: &Con
tracing::debug!(
target: "flows",
run_id,
-- step_count = merged.len(),
-- filled_from_reconstruction = merged.len(),
++ merged_step_count = merged.len(),
"[flows] settle_steps: merged live-observed steps with post-hoc reconstruction"
);
merged