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
feat(session_host): make recovery tool visible when summaries are active
Steven Enamakelb4a8f21e7822
diff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rsindex 9bfae33fa9..22a773d4b7 100644--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs@@ -759,7 +759,12 @@ impl OpenHumanSessionHost {// (e.g. the orchestrator's curated list). An empty set already means// "no filter", so it needs nothing. Added BEFORE the disallow filter// below so an agent that explicitly disallows it still has it removed.- super::ensure_recovery_tool_visible(&mut visible, config.context.compaction_enabled);+ // A summary names the tool in its footer too, and summaries run with+ // the router off, so either one makes the tool necessary.+ super::ensure_recovery_tool_visible(+ &mut visible,+ config.context.compaction_enabled || super::summarizes_tool_output(agent_id, config),+ );if let Some(def) = target_def {if !def.disallowed_tools.is_empty() {@@ -915,8 +920,7 @@ impl OpenHumanSessionHost {// itself MUST be `None` to avoid recursive self-summarization).let payload_summarizer: Option<std::sync::Arc<dyn crate::agent::tinyagents::payload_summarizer::PayloadSummarizer>,- > = if agent_id == "orchestrator" && config.context.summarizer_payload_threshold_tokens > 0- {+ > = if super::summarizes_tool_output(agent_id, config) {match crate::agent::harness::definition::AgentDefinitionRegistry::global() {Some(reg) => match reg.get("summarizer") {Some(summarizer_def) => {diff --git a/crates/openhuman-core/src/agent/session_host/builder/mod.rs b/crates/openhuman-core/src/agent/session_host/builder/mod.rsindex bb773421e9..12b06c2dd6 100644--- a/crates/openhuman-core/src/agent/session_host/builder/mod.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/mod.rs@@ -180,13 +180,20 @@ pub(super) fn visible_tool_specs_for_policy(/// off the wire. An empty set already means "no filter" (all tools visible),/// so it is left untouched — including the deliberately tool-less/// `Named([])` case, which must stay tool-less.+///+/// `recovery_needed` is whether anything can hand this agent a recovery+/// pointer: the compaction router ([`ContextConfig::compaction_enabled`]) or+/// TinyJuice's summary stage ([`summarizes_tool_output`]), whose footer names+/// the retrieve tool even when the router is off.+///+/// [`ContextConfig::compaction_enabled`]: crate::config::schema::ContextConfigpub(super) fn ensure_recovery_tool_visible(visible: &mut std::collections::HashSet<String>,- compaction_enabled: bool,+ recovery_needed: bool,) {- // With compaction off nothing ever emits a `⟦tj:…⟧` marker, so the- // recovery tool would be a schema with nothing to recover.- if !compaction_enabled {+ // Nothing emits a `⟦tj:…⟧` marker or a summary footer, so the recovery+ // tool would be a schema with nothing to recover.+ if !recovery_needed {return;}// `is_empty_tool_scope`, not `is_empty`: a belt holding only@@ -201,6 +208,12 @@ pub(super) fn ensure_recovery_tool_visible(}}+/// Whether TinyJuice may summarize this agent's tool output. Only the+/// orchestrator gets a summary model, and a zero threshold turns it off.+pub(super) fn summarizes_tool_output(agent_id: &str, config: &Config) -> bool {+ agent_id == "orchestrator" && config.context.summarizer_payload_threshold_tokens > 0+}+pub(super) fn should_synthesize_delegation_tools(def: &AgentDefinition) -> bool {match &def.tools {ToolScope::Wildcard => !def.subagents.is_empty(),