Skip to content

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

test(config): flip compaction and router defaults to opt-in

Steven Enamakeld96e98e58992
diff --git a/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs b/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs
index a8fa3f9cd7..085ec3c6dc 100644
--- a/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs
+++ b/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs
@@ -574,14 +574,18 @@ fn env_overlay_context_tool_result_budget_env_suppresses_legacy_migration() {
}
#[test]
-fn env_overlay_compaction_default_on_and_kill_switch() {
- // Default is on.
- assert!(Config::default().context.compaction_enabled);
+fn env_overlay_compaction_default_off_and_switch() {
+ // Default is off (tokenjuice compaction cost more retrieval round trips
+ // than it saved context).
+ assert!(!Config::default().context.compaction_enabled);
- // `OPENHUMAN_COMPACTION=0` disables it.
+ // `OPENHUMAN_COMPACTION=0` keeps it off; `=1` turns it on.
let mut cfg = Config::default();
cfg.apply_env_overlay_with(&HashMapEnv::new().with("OPENHUMAN_COMPACTION", "0"));
assert!(!cfg.context.compaction_enabled);
+ let mut cfg = Config::default();
+ cfg.apply_env_overlay_with(&HashMapEnv::new().with("OPENHUMAN_COMPACTION", "1"));
+ assert!(cfg.context.compaction_enabled);
// Truthy re-enables; the namespaced alias works too.
let mut cfg = Config::default();
@@ -593,6 +597,7 @@ fn env_overlay_compaction_default_on_and_kill_switch() {
// Garbage is ignored (leaves the prior value untouched).
let mut cfg = Config::default();
+ cfg.context.compaction_enabled = true;
cfg.apply_env_overlay_with(&HashMapEnv::new().with("OPENHUMAN_COMPACTION", "maybe"));
assert!(cfg.context.compaction_enabled);
}
diff --git a/crates/openhuman-core/src/config/schema/tokenjuice_tests.rs b/crates/openhuman-core/src/config/schema/tokenjuice_tests.rs
index c29c15fb56..c959922492 100644
--- a/crates/openhuman-core/src/config/schema/tokenjuice_tests.rs
+++ b/crates/openhuman-core/src/config/schema/tokenjuice_tests.rs
@@ -3,7 +3,8 @@ use super::*;
#[test]
fn defaults_are_sane() {
let c = TokenjuiceConfig::default();
- assert!(c.router_enabled);
+ // The router is opt-in (see `ContextConfig::compaction_enabled`).
+ assert!(!c.router_enabled);
assert!(c.ccr_enabled);
assert!(c.search_enabled);
assert!(!c.ml_compression_enabled);