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
refactor(session): remove manual cacheable prefix tracking from resume path
Steven Enamakel7b706bc4d226
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex 8e33a1cf1f..9d231daa06 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -1377,17 +1377,6 @@ impl OpenHumanSessionHost {}}}- // Resume restores the exact leading prompt messages from the durable- // transcript. Carry their count to the cache stamper: a later System- // compaction summary may be adjacent, but is not a frozen prompt tier.- let runtime = self- .runtime_session- .as_ref()- .expect("runtime session initialized");- let frozen_prefix_len = runtime.prefix_snapshot().messages().len();- if frozen_prefix_len > 0 || !runtime.history().is_empty() {- options.run_context.data.cacheable_system_prefix_len = Some(frozen_prefix_len);- }let outcome = self.runtime_session.as_mut()diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rsindex c93cbdc70e..e0f3bf7102 100644--- a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs+++ b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs@@ -449,17 +449,13 @@ pub(super) fn assemble_turn_harness(),));- // Prompt-cache prefix protection (issue #4249, 03.2). First declare the turn's- // stable prefix (system prompt + tool schemas) as `PromptSegment`s, then let- // the crate `PromptCacheGuardMiddleware` diff the cacheable prefix across model- // calls and record a `CacheLayoutEvent` when volatile content busts it.- // `before_model` hooks run in registration order, so the segment stamper must- // precede the guard; both run before the context middlewares below (they only- // touch the volatile tail / tool bodies, never the stable prefix). The guard is- // returned so the run loop can drain its events into the observability bridge —- // the crate-native replacement for the deleted `CacheAlignMiddleware` warn-log- // (C3: the warn-only shadow is gone; this guard is the sole owner).- harness.push_middleware(Arc::new(middleware::PromptCacheSegmentMiddleware));+ // Prompt-cache prefix protection (issue #4249, 03.2). The vendor loop owns+ // the stable-prefix layout (`PromptSegment`s built from the session's frozen+ // system prefix, `frozen_system_prefix_len`); the crate+ // `PromptCacheGuardMiddleware` diffs the cacheable prefix across model calls+ // and records a `CacheLayoutEvent` when volatile content busts it. The guard+ // is returned so the run loop can drain its events into the observability+ // bridge.let prompt_cache_guard = Arc::new(PromptCacheGuardMiddleware::new());harness.push_middleware(prompt_cache_guard.clone());diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rsindex 86ad363360..aab9227362 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs@@ -307,9 +307,6 @@ pub struct OpenHumanRunContext {/// the registry that recovers positional / code-style calls; `Auto`/// (the default) leaves the harness to choose from the model profile.pub(crate) tool_dialect: tinyagents_harness::config::ToolDispatcher,- /// Number of frozen system tiers restored from the session prefix. A- /// later System compaction summary remains outside this cacheable prefix.- pub(crate) cacheable_system_prefix_len: Option<usize>,}impl Default for OpenHumanRunContext {@@ -351,7 +348,6 @@ impl OpenHumanRunContext {session_sidecar: Arc::new(Mutex::new(SessionTurnSidecar::default())),required_output: None,tool_dialect: tinyagents_harness::config::ToolDispatcher::Auto,- cacheable_system_prefix_len: None,}}@@ -442,7 +438,6 @@ impl OpenHumanRunContext {child.parent_subagent_usage = Some(self.subagent_usage.clone());child.subagent_usage = Arc::new(Mutex::new(Vec::new()));child.resolved_route = Arc::new(Mutex::new(None));- child.cacheable_system_prefix_len = None;child}