Skip to content

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

refactor(session-host): consolidate recovery and REPL tool visibility logic

Steven Enamakele08f3805a59f
diff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
index c6e2de24e2..95c35e28df 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -757,16 +757,7 @@ impl OpenHumanSessionHost {
// below so an agent that explicitly disallows it still has it removed.
// 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),
- );
- // The handle preview names the REPL tools; a curated belt needs them
- // too, for exactly as long as they are registered.
- super::ensure_repl_tools_visible(
- &mut visible,
- crate::inference::tokenjuice::repl_handle_active(config),
- );
+ super::ensure_tinyjuice_tools_visible(&mut visible, agent_id, config);
if let Some(def) = target_def {
if !def.disallowed_tools.is_empty() {
diff --git a/crates/openhuman-core/src/agent/session_host/builder/mod.rs b/crates/openhuman-core/src/agent/session_host/builder/mod.rs
index bbe3879591..5b7539a453 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/mod.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/mod.rs
@@ -211,6 +211,22 @@ pub(super) fn ensure_recovery_tool_visible(
}
}
+/// The recovery tool, plus the REPL tools the handle preview names, for a belt.
+pub(super) fn ensure_tinyjuice_tools_visible(
+ visible: &mut std::collections::HashSet<String>,
+ agent_id: &str,
+ config: &crate::config::Config,
+) {
+ ensure_recovery_tool_visible(
+ visible,
+ config.context.compaction_enabled || summarizes_tool_output(agent_id, config),
+ );
+ ensure_repl_tools_visible(
+ visible,
+ crate::inference::tokenjuice::repl_handle_active(config),
+ );
+}
+
/// Ensure the REPL tools (`juice_find`, `juice_extract`, `juice_summarize`) are
/// members of a non-empty visibility allowlist while large results are stored
/// behind a handle. The handle preview names them, so a curated
diff --git a/scripts/ci/check-openhuman-rust-layout.mjs b/scripts/ci/check-openhuman-rust-layout.mjs
index 9b9b854126..1af111c1a2 100644
--- a/scripts/ci/check-openhuman-rust-layout.mjs
+++ b/scripts/ci/check-openhuman-rust-layout.mjs
@@ -47,7 +47,7 @@ const LEGACY_LIMIT_ENTRIES = [
["crates/openhuman-core/src/agent/session_host/builder/factory.rs", 1215],
["crates/openhuman-core/src/agent/subagent_host/lifecycle.rs", 1313],
["crates/openhuman-core/src/agent/subagent_host/ops/runner.rs", 1427],
- ["crates/openhuman-core/src/tools/ops.rs", 1342],
+ ["crates/openhuman-core/src/tools/ops.rs", 1341],
["crates/openhuman-core/src/web_chat/progress_bridge.rs", 1305],
// These established external test modules grew with upstream coverage. Pin
// their current sizes while follow-up work separates their test concerns.