Skip to content

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

refactor(core): simplify tokenjuice flag and test context helper

Steven Enamakel13be89a94a1e
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 8474ba212d..06452c15b3 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -735,12 +735,9 @@ impl OpenHumanSessionHost {
&self.event_session_id,
);
- // `[components] juice = false`: tool output is truncated only, never
- // compacted or summarized, and the module is never called for it.
- let juice_on = self
- .runtime_config
- .as_ref()
- .map_or(true, |config| crate::inference::tokenjuice::enabled(config));
+ // `[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 {
tool_result_budget_bytes,
diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rs
index 1a29727996..8f06b5b020 100644
--- a/crates/openhuman-core/src/core/runtime/context.rs
+++ b/crates/openhuman-core/src/core/runtime/context.rs
@@ -576,12 +576,10 @@ impl CoreContext {
/// Test-only constructor with the given `[components]` switches.
#[cfg(test)]
- pub(crate) fn for_test_with_components(
- components: crate::core::runtime::ComponentSet,
- ) -> Arc<CoreContext> {
+ 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!("fresh Arc"));
- ctx.components = components;
+ let mut ctx = Arc::try_unwrap(base).unwrap_or_else(|_| unreachable!());
+ ctx.components = c;
Arc::new(ctx)
}