Skip to content

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

chore: disable tokenjuice compaction by default

Steven Enamakel1deb293e2233
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 c08a443b17..bbb3e65d0a 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -751,7 +751,7 @@ 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);
+ super::ensure_recovery_tool_visible(&mut visible, config.context.compaction_enabled);
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 9c18d52ae2..859090ccc2 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/mod.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/mod.rs
@@ -179,7 +179,15 @@ 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.
-pub(super) fn ensure_recovery_tool_visible(visible: &mut std::collections::HashSet<String>) {
+pub(super) fn ensure_recovery_tool_visible(
+ visible: &mut std::collections::HashSet<String>,
+ compaction_enabled: 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 {
+ return;
+ }
// `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
diff --git a/crates/openhuman-core/src/config/schema/context.rs b/crates/openhuman-core/src/config/schema/context.rs
index d66a94b855..0e841a6fa6 100644
--- a/crates/openhuman-core/src/config/schema/context.rs
+++ b/crates/openhuman-core/src/config/schema/context.rs
@@ -102,19 +102,19 @@ pub struct ContextConfig {
#[serde(default = "default_true")]
pub prefer_markdown_tool_output: bool,
- /// Master switch for native tool-output compaction (Stage 1a). When
- /// `true` (the default), large structured tool outputs (build/test logs,
- /// diffs, JSON arrays) are content-aware compressed in
- /// `OpenHumanSessionHost::execute_tool_call` *before* the [`Self::tool_result_budget_bytes`]
- /// byte cap and before they enter history. The compression never drops the
- /// first/last/high-signal lines and only ever shrinks output, so it is on
- /// by default.
+ /// Switch for tokenjuice tool-output compaction (Stage 1a). When `true`,
+ /// large structured tool outputs (build/test logs, diffs, JSON arrays) are
+ /// content-aware compressed *before* the [`Self::tool_result_budget_bytes`]
+ /// byte cap and before they enter history, with a `⟦tj:<hash>⟧` marker the
+ /// model can redeem through `tinyjuice_retrieve`.
///
- /// This is invisible infrastructure (like microcompact/autocompact): no
- /// user-facing UI. The only reason to flip it off is a support / debugging
- /// / A/B bisect, via config or the `OPENHUMAN_COMPACTION=0` env override.
- /// See `compaction-plan.md`.
- #[serde(default = "default_true")]
+ /// **Off by default** since the 2026-09 latency work: in practice the
+ /// compacted view cost the model a retrieval round trip more often than it
+ /// saved context, and every curated belt paid for the retrieve tool's
+ /// schema on every turn. The per-tool char cap and the shared byte
+ /// backstop (which persists oversized output for `file_read`) stay on.
+ /// Turn it back on via config or `OPENHUMAN_COMPACTION=1`.
+ #[serde(default)]
pub compaction_enabled: bool,
}
@@ -159,7 +159,7 @@ impl Default for ContextConfig {
session_memory: SessionMemoryConfig::default(),
summarizer_model: None,
prefer_markdown_tool_output: default_true(),
- compaction_enabled: default_true(),
+ compaction_enabled: false,
}
}
}
diff --git a/crates/openhuman-core/src/config/schema/tokenjuice.rs b/crates/openhuman-core/src/config/schema/tokenjuice.rs
index 9aa66f6b4b..f65d746d8b 100644
--- a/crates/openhuman-core/src/config/schema/tokenjuice.rs
+++ b/crates/openhuman-core/src/config/schema/tokenjuice.rs
@@ -12,8 +12,8 @@ use serde::{Deserialize, Serialize};
#[serde(default)]
pub struct TokenjuiceConfig {
/// Master switch for the content router. When `false`, tool output passes
- /// through uncompacted.
- #[serde(default = "default_true")]
+ /// through uncompacted. Off by default: see `ContextConfig::compaction_enabled`.
+ #[serde(default)]
pub router_enabled: bool,
/// Whether lossy compressions offload the original to the CCR store and emit
/// a `⟦tj:<hash>⟧` retrieval footer. Disabling makes compaction one-way.
@@ -107,7 +107,7 @@ fn default_ml_device() -> String {
impl Default for TokenjuiceConfig {
fn default() -> Self {
Self {
- router_enabled: true,
+ router_enabled: false,
ccr_enabled: true,
ccr_disk_enabled: false,
max_cache_entries: default_max_cache_entries(),