Skip to content

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

chore: files changed src/openhuman/agent/harness/session/builder/factory.rs,src/openhuman/agent/harn

Steven Enamakel6fe60bec0f96
diff --git a/src/openhuman/agent/harness/session/builder/factory.rs b/src/openhuman/agent/harness/session/builder/factory.rs
index 7bb73a2503..28e50903b3 100644
--- a/src/openhuman/agent/harness/session/builder/factory.rs
+++ b/src/openhuman/agent/harness/session/builder/factory.rs
@@ -3,6 +3,7 @@
use super::helpers::prefetch_tool_memory_rules_blocking;
use super::should_synthesize_delegation_tools;
+use crate::openhuman::agent::harness::definition::NO_TOOLS_SENTINEL;
use crate::openhuman::agent::context::prompt::SystemPromptBuilder;
use crate::openhuman::agent::dispatcher::{
NativeToolDispatcher, PFormatToolDispatcher, XmlToolDispatcher,
@@ -866,6 +867,14 @@ impl Agent {
}
set.insert(t.name().to_string());
}
+ // `named = []` means zero tools. An empty set here is
+ // the harness's "no filter" sentinel and would advertise
+ // the whole registry instead — the exact inversion that
+ // handed `summarizer` and `trigger_triage` 109 tools
+ // each. Spell the empty belt so it survives.
+ if set.is_empty() {
+ set.insert(NO_TOOLS_SENTINEL.to_string());
+ }
Some(set)
}
ToolScope::Wildcard => None,
@@ -916,7 +925,17 @@ impl Agent {
tool scope"
);
let filter: Option<std::collections::HashSet<String>> = match &def.tools {
- ToolScope::Named(names) => Some(names.iter().cloned().collect()),
+ ToolScope::Named(names) => {
+ let mut set: std::collections::HashSet<String> =
+ names.iter().cloned().collect();
+ // Same rule as the branch above: an empty named scope
+ // is zero tools, and an empty set would mean the
+ // opposite.
+ if set.is_empty() {
+ set.insert(NO_TOOLS_SENTINEL.to_string());
+ }
+ Some(set)
+ }
ToolScope::Wildcard => None,
};
(Vec::new(), filter)
@@ -999,7 +1018,7 @@ impl Agent {
// non-empty with an unregistered name so it advertises and
// permits zero tools rather than accidentally broadening.
if visible.is_empty() {
- visible.insert("__profile_no_tools__".to_string());
+ visible.insert(NO_TOOLS_SENTINEL.to_string());
}
}
}
diff --git a/src/openhuman/agent/harness/session/builder/mod.rs b/src/openhuman/agent/harness/session/builder/mod.rs
index 235b267fcd..0c3a9a9176 100644
--- a/src/openhuman/agent/harness/session/builder/mod.rs
+++ b/src/openhuman/agent/harness/session/builder/mod.rs
@@ -73,7 +73,12 @@ pub(super) fn visible_tool_specs_for_policy(
/// means "no filter" (all tools visible), so it is left untouched — including
/// the deliberately tool-less `Named([])` case, which must stay tool-less.
pub(super) fn ensure_recovery_tool_visible(visible: &mut std::collections::HashSet<String>) {
- if !visible.is_empty() {
+ // `is_empty_tool_scope`, not `is_empty`: a belt holding only
+ // `NO_TOOLS_SENTINEL` is a deliberate zero-tool agent, and the compaction
+ // recovery tool has nothing to recover for one — there are no tool outputs
+ // to truncate. Adding it would turn "no tools" into "one tool" and put a
+ // schema back on a turn whose whole point is that it stays flat.
+ if !crate::openhuman::agent::harness::definition::is_empty_tool_scope(visible) {
for name in crate::openhuman::inference::tokenjuice::RECOVERY_TOOL_NAMES {
visible.insert((*name).to_string());
}