Skip to content

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

refactor(session_host): inline juice gating into config destructuring

Steven Enamakel3996302b77c1
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
index 06452c15b3..9f9cb4476f 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -713,7 +713,7 @@ impl OpenHumanSessionHost {
}
let (
tool_result_budget_bytes,
- tokenjuice_compaction_enabled,
+ tokenjuice_compaction_enabled: tokenjuice_compaction_enabled && juice_on,
microcompact_keep_recent,
autocompact_enabled,
compaction,
@@ -736,10 +736,8 @@ impl OpenHumanSessionHost {
);
// `[components] juice = false`: truncation only, no compaction/summary.
- let juice_on = (self.runtime_config.as_ref())
- .map_or(true, |c| crate::inference::tokenjuice::enabled(c));
- let tokenjuice_compaction_enabled = tokenjuice_compaction_enabled && juice_on;
- let context_mw = TurnContextMiddleware {
+ let juice_on = (self.runtime_config.as_ref()).map_or(true, |c| tokenjuice::enabled(c));
+ let context_mw = TurnContextMiddleware {
tool_result_budget_bytes,
payload_summarizer: self.payload_summarizer.clone().filter(|_| juice_on),
// Rooted outside the project; see `artifact_wiring` (#6408, #6483).
diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rs
index 8f06b5b020..8d9dd61b62 100644
--- a/crates/openhuman-core/src/core/runtime/context.rs
+++ b/crates/openhuman-core/src/core/runtime/context.rs
@@ -574,11 +574,10 @@ impl CoreContext {
})
}
- /// Test-only constructor with the given `[components]` switches.
+ /// Test-only: given `[components]` switches.
#[cfg(test)]
pub(crate) fn for_test_with_components(c: crate::core::runtime::ComponentSet) -> Arc<Self> {
- let base = Self::for_test(crate::core::runtime::DomainSet::full(), None);
- let mut ctx = Arc::try_unwrap(base).unwrap_or_else(|_| unreachable!());
+ let mut ctx = Arc::try_unwrap(Self::for_test(super::DomainSet::full(), None)).ok().unwrap();
ctx.components = c;
Arc::new(ctx)
}