Skip to content

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

fix(config): switch summarizer to on-demand mode and lower max payload default

Steven Enamakelbb65c4afdc8e
diff --git a/crates/openhuman-core/src/config/schema/context.rs b/crates/openhuman-core/src/config/schema/context.rs
index 5d0aadd5fa..114b2ee3ef 100644
--- a/crates/openhuman-core/src/config/schema/context.rs
+++ b/crates/openhuman-core/src/config/schema/context.rs
@@ -50,12 +50,12 @@ pub struct ContextConfig {
#[serde(default = "default_tool_result_budget_bytes")]
pub tool_result_budget_bytes: usize,
- /// Tool results larger than this **token** count trigger the
- /// `summarizer` sub-agent (orchestrator session only). The summarizer
- /// compresses the payload into a dense note that preserves
- /// identifiers and key facts, and the compressed summary replaces
- /// the raw payload before it enters agent history. Default: 4000 tokens.
- /// Set to 0 to disable.
+ /// Tool results larger than this **token** count are stored behind a
+ /// TinyJuice recovery handle (orchestrator session only), and the
+ /// `summarizer` model is available to them on request: it runs only when
+ /// the agent calls `juice_summarize`, never on its own as the result
+ /// arrives (TinyJuice `LlmSummaryMode::OnDemand`). Default: 4000 tokens.
+ /// Set to 0 to disable the summary model.
///
/// Token count is estimated as `chars / 4` (the same heuristic used
/// by `tree_summarizer::estimate_tokens`). Pairs with
@@ -69,12 +69,13 @@ pub struct ContextConfig {
)]
pub summarizer_payload_threshold_tokens: usize,
- /// Hard cap on payload size (in **tokens**) above which summarization
- /// is skipped entirely and the existing
- /// [`Self::tool_result_budget_bytes`] truncation path takes over.
- /// Default: `2_000_000` tokens (above the context window of every
- /// model we ship against — a payload this big can't be summarized
- /// cost-effectively).
+ /// Most input (in **tokens**) one summary call sends to the model.
+ /// TinyJuice lowers it further to what `llm_summary_timeout_ms` can
+ /// prefill, and samples a larger output down to the head, the tail and
+ /// the lines matching the agent's hint rather than sending it whole.
+ /// Default: `64_000` tokens. The old `2_000_000` default let a single
+ /// summary send a 418k-token request that the timeout then cancelled
+ /// after it was billed.
#[serde(
default = "default_summarizer_max_payload_tokens",
alias = "summarizer_max_payload_bytes"
@@ -151,7 +152,7 @@ fn default_summarizer_payload_threshold_tokens() -> usize {
}
fn default_summarizer_max_payload_tokens() -> usize {
- 2_000_000
+ 64_000
}
impl Default for ContextConfig {
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod.rs b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
index 0934606697..a006b91137 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
@@ -100,6 +100,10 @@ pub(crate) fn install_request(config: &crate::config::Config) -> InstallRequest
// only a turn whose agent carries a summary model supplies — so
// switching it on here enables it for those turns, not for all.
llm_summary_enabled: config.context.summarizer_payload_threshold_tokens > 0,
+ // Never at ingest: a large result gets deterministic compression
+ // and a recovery handle, and the model writes a summary only when
+ // the agent asks for one with `juice_summarize` (#6955).
+ llm_summary_mode: types::LlmSummaryMode::OnDemand,
llm_summary_threshold_tokens: config.context.summarizer_payload_threshold_tokens,
llm_summary_max_input_tokens: config.context.summarizer_max_payload_tokens,
repl_handle: repl_handle_active(config),
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
index 0764e821e3..c268a02453 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
@@ -328,7 +328,7 @@ fn install_request_summarizes_only_on_request_under_a_64k_cap() {
assert!(request.options.llm_summary_enabled);
assert_eq!(
request.options.llm_summary_mode,
- tinyjuice_bus::types::LlmSummaryMode::OnDemand,
+ types::LlmSummaryMode::OnDemand,
"ingest must never call the summary model on its own"
);
assert_eq!(request.options.llm_summary_max_input_tokens, 64_000);
diff --git a/crates/openhuman-core/src/inference/tokenjuice/types.rs b/crates/openhuman-core/src/inference/tokenjuice/types.rs
index bb6b92d8a6..368405a22a 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/types.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/types.rs
@@ -17,7 +17,7 @@
pub use tinyjuice_bus::types::{
AgentTokenjuiceCompression, CompressOptions, CompressedOutput, CompressorKind, ContentHint,
- ContentKind,
+ ContentKind, LlmSummaryMode,
};
pub use tinyjuice_bus::wire::{
CacheStats, CompactRequest, CompactResponse, GenerateRequest, InstallRequest, RangeUnit,