Skip to content

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

fix: correct test module paths for consistent naming

Steven Enamakela738ce1cd435
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
index 1d2500fe5f..5430b663da 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
@@ -451,3 +451,25 @@ fn the_recovery_tool_joins_a_belt_only_when_something_can_point_at_it() {
config.context.summarizer_payload_threshold_tokens = 0;
assert!(!super::summarizes_tool_output("orchestrator", &config));
}
+
+#[test]
+fn the_repl_tools_join_a_belt_only_while_handle_mode_is_active() {
+ use crate::inference::tokenjuice::REPL_TOOL_NAMES;
+ let belt = || std::collections::HashSet::from(["web_fetch".to_string()]);
+
+ let mut inactive = belt();
+ super::ensure_repl_tools_visible(&mut inactive, false);
+ assert!(REPL_TOOL_NAMES.iter().all(|n| !inactive.contains(*n)));
+
+ let mut active = belt();
+ super::ensure_repl_tools_visible(&mut active, true);
+ assert!(REPL_TOOL_NAMES.iter().all(|n| active.contains(*n)));
+
+ // "No filter" and "deliberately no tools" both stay as they were.
+ let mut unfiltered = std::collections::HashSet::new();
+ super::ensure_repl_tools_visible(&mut unfiltered, true);
+ assert!(unfiltered.is_empty());
+ let mut none = std::collections::HashSet::from([NO_TOOLS_SENTINEL.to_string()]);
+ super::ensure_repl_tools_visible(&mut none, true);
+ assert_eq!(none.len(), 1);
+}
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs
index e628c7364e..dc1815658f 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs
@@ -339,3 +339,16 @@ async fn a_run_without_a_thread_keeps_one_scope() {
assert_eq!(scopes[0], Some(format!("run-{}", ctx.instance_id())));
assert_eq!(scopes[0], scopes[1]);
}
+
+#[test]
+fn repl_tools_are_exempt_from_compaction_but_not_from_the_cap() {
+ // Compacting a `juice_find` answer would store it behind a second handle.
+ // The byte cap must still apply: each REPL tool declares its own limit.
+ for tool in crate::inference::tokenjuice::REPL_TOOL_NAMES {
+ assert!(is_compaction_exempt(tool), "{tool} must not be compacted");
+ assert!(
+ !is_truncation_exempt(tool),
+ "{tool}'s answer must stay size-capped"
+ );
+ }
+}
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
index 35fb7f062d..96654f2446 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
@@ -298,3 +298,48 @@ fn a_legacy_compact_reply_is_silent_when_no_summary_was_wanted() {
fn a_failed_legacy_compact_reply_gives_up() {
assert!(finish_legacy_compact_reply(Err(method_failed_error()), true).is_none());
}
+
+#[test]
+fn install_request_turns_on_the_handle_preview_by_default() {
+ let config = crate::config::Config::default();
+ assert!(repl_handle_active(&config));
+ let request = install_request(&config);
+ assert!(request.options.router_enabled);
+ assert!(request.options.ccr_enabled);
+ assert!(request.options.repl_handle);
+ // The plain-text copy on disk is opt-in.
+ assert_eq!(request.options.repl_save_dir, None);
+}
+
+#[test]
+fn install_request_handle_mode_follows_every_switch_it_needs() {
+ for flip in [
+ (|c: &mut crate::config::Config| c.context.compaction_enabled = false)
+ as fn(&mut crate::config::Config),
+ |c| c.tokenjuice.router_enabled = false,
+ |c| c.tokenjuice.ccr_enabled = false,
+ |c| c.tokenjuice.repl_handle_enabled = false,
+ ] {
+ let mut config = crate::config::Config::default();
+ flip(&mut config);
+ config.tokenjuice.repl_save_enabled = true;
+ let request = install_request(&config);
+ assert!(!request.options.repl_handle);
+ assert_eq!(
+ request.options.repl_save_dir, None,
+ "no handle, so nothing to save a copy of"
+ );
+ }
+}
+
+#[test]
+fn install_request_saves_a_copy_under_the_workspace_when_asked() {
+ let mut config = crate::config::Config::default();
+ config.workspace_dir = std::path::PathBuf::from("/ws");
+ config.tokenjuice.repl_save_enabled = true;
+ let request = install_request(&config);
+ assert_eq!(
+ request.options.repl_save_dir,
+ Some(std::path::PathBuf::from("/ws/.tokenjuice/repl"))
+ );
+}