The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(config): remove unused context-related code
Steven Enamakel33b1a3a07938
diff --git a/crates/openhuman-core/src/agent/context/manager.rs b/crates/openhuman-core/src/agent/context/manager.rsindex dd896f126c..99d96138d5 100644--- a/crates/openhuman-core/src/agent/context/manager.rs+++ b/crates/openhuman-core/src/agent/context/manager.rs@@ -90,6 +90,9 @@ pub struct ContextManager {/// overriding the window fraction. See/// [`ContextConfig::compaction_trigger_tokens`].compaction_trigger_tokens: Option<u64>,+ /// `[context].compaction_strategy`. See+ /// [`ContextConfig::compaction_strategy`].+ compaction_strategy: crate::openhuman::config::schema::CompactionStrategy,}impl ContextManager {@@ -124,6 +127,7 @@ impl ContextManager {// autocompaction specifically is turned off.autocompact_enabled: config.enabled && config.autocompact_enabled,compaction_trigger_tokens: config.compaction_trigger_tokens.filter(|t| *t > 0),+ compaction_strategy: config.compaction_strategy,}}@@ -168,6 +172,11 @@ impl ContextManager {self.compaction_trigger_tokens}+ /// How compaction writes its checkpoint.+ pub fn compaction_strategy(&self) -> crate::openhuman::config::schema::CompactionStrategy {+ self.compaction_strategy+ }+// ─── Budget tracking ──────────────────────────────────────────/// Feed the latest provider [`BilledUsage`] into utilisation stats and thediff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex 2e549258b6..c833271616 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -1388,6 +1388,7 @@ impl OpenHumanSessionHost {microcompact_keep_recent,autocompact_enabled,compaction_trigger_tokens,+ compaction_strategy,) = {let context = self.context@@ -1399,6 +1400,7 @@ impl OpenHumanSessionHost {context.microcompact_keep_recent(),context.autocompact_enabled(),context.compaction_trigger_tokens(),+ context.compaction_strategy(),)};let artifact_store = super::artifact_wiring::build_artifact_store(@@ -1419,6 +1421,7 @@ impl OpenHumanSessionHost {microcompact_keep_recent,autocompact_enabled,compaction_trigger_tokens,+ compaction_strategy,transcript_snapshot: None,};let driver = Arc::new(OpenHumanSessionDriver::new(diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rsindex 2947a57aac..d246591cb2 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph/dispatch.rs@@ -554,6 +554,7 @@ fn build_subagent_context_mw(// opt-outs, same as `ContextManager::autocompact_enabled`.mw.autocompact_enabled = ctx.enabled && ctx.autocompact_enabled;mw.compaction_trigger_tokens = ctx.compaction_trigger_tokens.filter(|t| *t > 0);+ mw.compaction_strategy = ctx.compaction_strategy;tracing::debug!(tokenjuice_compaction_enabled = mw.tokenjuice_compaction_enabled,compression = ?mw.tokenjuice_compression,diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rsindex 2112d551cb..54062cefa2 100644--- a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs+++ b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs@@ -294,6 +294,7 @@ pub(super) fn assemble_turn_harness(// Capture context settings before `install` consumes `context_mw`.let autocompact_enabled = context_mw.autocompact_enabled;let compaction_trigger_tokens = context_mw.compaction_trigger_tokens;+ let compaction_strategy = context_mw.compaction_strategy;// Captured for the same reason `autocompact_enabled` is — `install` consumes// `context_mw` — and used to site microcompact below, after compression.let microcompact_keep_recent = context_mw.microcompact_keep_recent;@@ -582,6 +583,7 @@ pub(super) fn assemble_turn_harness(context_window,autocompact_enabled,compaction_trigger_tokens,+ compaction_strategy,microcompact_keep_recent,summarizer_model,pause_at_cap && subagent_scope.is_none(),diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rsindex 3112ff0fb9..93da7f1869 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/turn_context.rs@@ -59,6 +59,8 @@ pub(crate) struct TurnContextMiddleware {/// overriding the window fraction, and installing compaction even when the/// window is unknown. `None` (the default) keeps 90% of the window.pub(crate) compaction_trigger_tokens: Option<u64>,+ /// `[context].compaction_strategy`: how compaction writes its checkpoint.+ pub(crate) compaction_strategy: crate::openhuman::config::schema::CompactionStrategy,/// Live transcript snapshot sink (#4466). When set, a/// [`TranscriptSnapshotMiddleware`] mirrors the running conversation into/// this shared buffer before every model call, so an erroring run can still@@ -352,6 +354,7 @@ impl TurnContextMiddleware {microcompact_keep_recent: 0,autocompact_enabled: true,compaction_trigger_tokens: None,+ compaction_strategy: Default::default(),transcript_snapshot: None,}}diff --git a/crates/openhuman-core/src/config/schema/context.rs b/crates/openhuman-core/src/config/schema/context.rsindex b02aa42720..42d8541178 100644--- a/crates/openhuman-core/src/config/schema/context.rs+++ b/crates/openhuman-core/src/config/schema/context.rs@@ -134,6 +134,41 @@ pub struct ContextConfig {/// `OPENHUMAN_COMPACTION_TRIGGER_TOKENS`.#[serde(default)]pub compaction_trigger_tokens: Option<u64>,++ /// How a compaction writes its checkpoint. `task_state` (the default) is a+ /// typed task state: facts copied from tool calls (original task, files+ /// modified and read, recent commands and errors) plus one structured+ /// model call, over a 20k-token verbatim tail. `summary` is the earlier+ /// free-form LLM summary over the last 8 messages. Env:+ /// `OPENHUMAN_COMPACTION_STRATEGY`.+ #[serde(default)]+ pub compaction_strategy: CompactionStrategy,+}++/// How a context compaction writes its checkpoint. See+/// [`ContextConfig::compaction_strategy`].+#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]+#[serde(rename_all = "snake_case")]+pub enum CompactionStrategy {+ /// Typed task state (TinyAgents `TaskStateSummarizer`) over a+ /// token-budgeted tail. Chosen by the openhuman-benchmarks compaction eval.+ #[default]+ TaskState,+ /// Free-form LLM summary (TinyAgents `ModelSummarizer`) over the last+ /// `keep_last` messages.+ Summary,+}++impl CompactionStrategy {+ /// Parses a config or env value (`task_state`/`typed`, `summary`).+ #[must_use]+ pub fn parse(raw: &str) -> Option<Self> {+ match raw.trim().to_ascii_lowercase().replace('-', "_").as_str() {+ "task_state" | "typed" | "s4" => Some(Self::TaskState),+ "summary" | "free_form" | "s0" => Some(Self::Summary),+ _ => None,+ }+ }}fn default_enabled() -> bool {@@ -179,6 +214,7 @@ impl Default for ContextConfig {prefer_markdown_tool_output: default_true(),compaction_enabled: default_true(),compaction_trigger_tokens: None,+ compaction_strategy: CompactionStrategy::default(),}}}diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay/dictation_context.rs b/crates/openhuman-core/src/config/schema/load/env_overlay/dictation_context.rsindex ec808be1b7..f087348883 100644--- a/crates/openhuman-core/src/config/schema/load/env_overlay/dictation_context.rs+++ b/crates/openhuman-core/src/config/schema/load/env_overlay/dictation_context.rs@@ -84,6 +84,16 @@ impl Config {_ => {}}}+ if let Some(val) = env.get("OPENHUMAN_COMPACTION_STRATEGY") {+ match crate::openhuman::config::schema::CompactionStrategy::parse(&val) {+ Some(strategy) => self.context.compaction_strategy = strategy,+ None if val.trim().is_empty() => {}+ None => tracing::warn!(+ value = %val.trim(),+ "[config] ignoring unknown OPENHUMAN_COMPACTION_STRATEGY (task_state | summary)"+ ),+ }+ }// Absolute compaction trigger (benchmarks / debugging). `0` or an// empty value clears an override set in `config.toml`.if let Some(val) = env.get("OPENHUMAN_COMPACTION_TRIGGER_TOKENS") {diff --git a/crates/openhuman-core/src/config/schema/mod.rs b/crates/openhuman-core/src/config/schema/mod.rsindex 815ab3170f..99afb5b8e9 100644--- a/crates/openhuman-core/src/config/schema/mod.rs+++ b/crates/openhuman-core/src/config/schema/mod.rs@@ -86,7 +86,7 @@ pub use channels::{StreamMode, TelegramConfig, WebhookConfig, WhatsAppConfig, YuanbaoConfig,};pub(crate) use cli_overrides::set_cli_inference_overrides;-pub use context::ContextConfig;+pub use context::{CompactionStrategy, ContextConfig};pub use cron::CronConfig;pub use dashboard::{DashboardConfig, DiagramViewerConfig, EventStreamConfig, ModelHealthConfig};pub use dictation::{DictationActivationMode, DictationConfig};