The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
Merge remote-tracking branch 'upstream/main' into bench-6958-iteration-cap
Steven Enamakel877760316762
diff --cc crates/openhuman-core/src/agent/session_host/builder/factory.rsindex 58c8768986,608cf3db0f..c808286d49--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs@@@ -954,51 -954,63 +954,46 @@@ impl OpenHumanSessionHost// `agent_harness_e2e` mock now serves SSE for streaming, so the crate-native// streaming path is exercised end-to-end.//- // Issue #4868 — resolve the per-agent iteration cap. When a named- // definition is present, its `effective_max_iterations()` (which honors- // `iteration_policy = "extended"` -> 50, and the declared `max_iterations`- // for strict agents) takes priority over the global- // `config.agent.max_tool_iterations` (default 10). This is the single- // shared resolution point that closes #4868 for every direct-invocation- // path: flows_build, flows_discover, agent-node runtime, cron, MCP- // server, etc. Falls back to the global default when there is no- // definition for this agent_id.+ // Issue #4868 / #6958 — resolve the per-agent iteration cap at its one+ // shared resolution point (explicit override, then the definition's+ // `effective_max_iterations()`, then the global default). See+ // `iteration_cap::resolve_max_tool_iterations`.let mut effective_agent_config = config.agent.clone();- if let Some(def) = target_def {- let def_cap = def.effective_max_iterations();- log::info!(- "[agent::builder] applying definition iteration cap for agent_id={}: \- definition.max_iterations={} iteration_policy={:?} -> effective={} \- (was global default {})",- agent_id,- def.max_iterations,- def.iteration_policy,- def_cap,- config.agent.max_tool_iterations,- );- effective_agent_config.max_tool_iterations = def_cap;- }+ effective_agent_config.max_tool_iterations =+ super::iteration_cap::resolve_max_tool_iterations(&config.agent, target_def);- // Host-first, so a host tool wins a name collision -- see- // `HostTurnTools::merge_into`, which owns that rule and why.- let (host_policy, withheld_tool_names) =- super::host_tools::merge_for_turn(host, agent_id, session_id, &mut tools, &mut visible);- let mut builder = OpenHumanSessionHost::builder()- .crate_native_provider(provider_role, Arc::clone(&base_config))- .tools(tools)- .synthesized_tools(delegation_tools)- .visible_tool_names(visible)- .withheld_tool_names(withheld_tool_names)- .deferred_tools(target_def.map_or_else(Vec::new, |d| d.deferred_tools.clone()))- .memory(memory)- .auto_recall(Some(auto_recall))- .tool_dispatcher(tool_dispatcher)- .prompt_builder(prompt_builder)- .config(effective_agent_config)- .context_config(config.context.clone())- .model_name(model_name)- .model_vision(model_vision)- .temperature(effective_temperature)- .workspace_dir(config.workspace_dir.clone())- .action_dir(config.action_dir.clone())- .workspace_descriptor(workspace_descriptor)- .workflows({- let mut catalogue = crate::skills::load_workflow_metadata(&config.workspace_dir);- #[cfg(feature = "flows")]- catalogue.extend(crate::flows::catalogue::flow_entries(config));- catalogue- })- .auto_save(config.memory.auto_save)- .post_turn_hooks(post_turn_hooks)- .learning_enabled(config.learning.enabled)- .explicit_preferences_enabled(config.learning.explicit_preferences_enabled)- .agent_definition_name(agent_id.to_string())- .omit_profile(effective_omit_profile)- .omit_memory_md(effective_omit_memory_md)- .trigger_memory_agent(effective_trigger_memory_agent)- .tokenjuice_compression(effective_tokenjuice_compression);+ let mut builder =+ super::host_tools::tool_builder(host, agent_id, session_id, tools, visible)?+ .crate_native_provider(provider_role, Arc::clone(&base_config))+ .synthesized_tools(delegation_tools)+ .deferred_tools(target_def.map_or_else(Vec::new, |d| d.deferred_tools.clone()))+ .memory(memory)+ .auto_recall(Some(auto_recall))+ .tool_dispatcher(tool_dispatcher)+ .prompt_builder(prompt_builder)+ .config(effective_agent_config)+ .context_config(config.context.clone())+ .model_name(model_name)+ .model_vision(model_vision)+ .temperature(effective_temperature)+ .workspace_dir(config.workspace_dir.clone())+ .action_dir(config.action_dir.clone())+ .workspace_descriptor(workspace_descriptor)+ .workflows({+ let mut catalogue =+ crate::skills::load_workflow_metadata(&config.workspace_dir);+ #[cfg(feature = "flows")]+ catalogue.extend(crate::flows::catalogue::flow_entries(config));+ catalogue+ })+ .auto_save(config.memory.auto_save)+ .post_turn_hooks(post_turn_hooks)+ .learning_enabled(config.learning.enabled)+ .explicit_preferences_enabled(config.learning.explicit_preferences_enabled)+ .agent_definition_name(agent_id.to_string())+ .omit_profile(effective_omit_profile)+ .omit_memory_md(effective_omit_memory_md)+ .trigger_memory_agent(effective_trigger_memory_agent)+ .tokenjuice_compression(effective_tokenjuice_compression);if let Some(ps) = payload_summarizer {builder = builder.payload_summarizer(ps);}diff --cc crates/openhuman-core/src/agent/session_host/builder/mod.rsindex 9dc520fde9,905cf04e92..ee87fc2648--- a/crates/openhuman-core/src/agent/session_host/builder/mod.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/mod.rs@@@ -13,7 -13,7 +13,8 @@@ mod dispatchermod factory;mod helpers;mod host_tools;+mod iteration_cap;+ mod permanent_tool;mod setters;pub use host_tools::{HostTools, HostTurnTools, TurnContext};diff --cc scripts/ci/check-openhuman-rust-layout.mjsindex b6d6fc5a83,bc87e78b1b..ddf064cc68--- a/scripts/ci/check-openhuman-rust-layout.mjs+++ b/scripts/ci/check-openhuman-rust-layout.mjs@@@ -43,7 -43,7 +43,7 @@@ const LEGACY_LIMIT_ENTRIES =// provider, security, memory, tool and prompt policy. Generic session// state moved to tinyagents-runtime; this remaining composition is split in// a follow-up without reintroducing an old harness/session exception.- ["crates/openhuman-core/src/agent/session_host/builder/factory.rs", 1195],- ["crates/openhuman-core/src/agent/session_host/builder/factory.rs", 1198],++ ["crates/openhuman-core/src/agent/session_host/builder/factory.rs", 1181],["crates/openhuman-core/src/agent/subagent_host/lifecycle.rs", 1309],["crates/openhuman-core/src/agent/subagent_host/ops/runner.rs", 1427],["crates/openhuman-core/src/tools/ops.rs", 1322],