Skip to content

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

feat(agent): thread summarizer model id into compaction wiring

Steven Enamakel6d196fa480e0
diff --git a/crates/openhuman-core/src/agent/tinyagents/context_wiring.rs b/crates/openhuman-core/src/agent/tinyagents/context_wiring.rs
index b44cd766d4..feebee64e4 100644
--- a/crates/openhuman-core/src/agent/tinyagents/context_wiring.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/context_wiring.rs
@@ -103,6 +103,7 @@ pub(super) fn install_context_ladder(
compaction_strategy: crate::config::CompactionStrategy,
microcompact_keep_recent: usize,
summarizer_model: Arc<dyn tinyinference_llm::model::ChatModel<()>>,
+ summarizer_model_id: &str,
wrap_up_at_cap: bool,
tool_outcome_sink: &ToolOutcomeSink,
memory_turn: Option<Arc<crate::memory::lifecycle::hooks::MemoryTurn>>,
@@ -121,6 +122,7 @@ pub(super) fn install_context_ladder(
compaction_strategy,
context_window,
summarizer_model,
+ summarizer_model_id,
model,
memory_turn,
compaction_notice,
@@ -169,11 +171,15 @@ pub(super) fn install_context_ladder(
/// The compression middleware for `strategy`: `TaskState` writes a typed
/// checkpoint over a token-budgeted tail, `Summary` is the free-form summarizer.
+/// `summarizer_model_id` names the model `summarizer_model` calls, for the
+/// summarizer's logs and summary provenance; `model` is the turn's.
+#[allow(clippy::too_many_arguments)]
fn compression_middleware(
policy: SummarizationPolicy,
strategy: crate::config::CompactionStrategy,
context_window: Option<u64>,
summarizer_model: Arc<dyn tinyinference_llm::model::ChatModel<()>>,
+ summarizer_model_id: &str,
model: &str,
memory_turn: Option<Arc<crate::memory::lifecycle::hooks::MemoryTurn>>,
compaction_notice: Option<CompactionNotice>,
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec/drive.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec/drive.rs
index 606c556c65..06d2a6a2c6 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec/drive.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec/drive.rs
@@ -114,6 +114,7 @@ pub(super) async fn drive_turn(
primary,
routes: tier_routes,
summarizer: summarizer_model,
+ summarizer_model_id,
error_slot,
..
} = turn_models;
@@ -325,6 +326,7 @@ pub(super) async fn drive_turn(
}),
memory_turn: run_context.memory_turn.clone(),
summarizer_model,
+ summarizer_model_id,
failure_map: failure_map.clone(),
provider_usage_carry: provider_usage_carry.clone(),
tool_outcome_sink: tool_outcome_sink.clone(),
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
index 5f79461f91..2c052e18d5 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
@@ -99,6 +99,9 @@ pub(super) struct TurnMiddlewareInputs {
pub(super) memory_turn: Option<Arc<crate::memory::lifecycle::hooks::MemoryTurn>>,
/// The context-window summarizer's model.
pub(super) summarizer_model: Arc<dyn tinyinference_llm::model::ChatModel<()>>,
+ /// The model id `summarizer_model` calls (`[context] summarizer_model`,
+ /// else the turn's model), for compaction logs and provenance.
+ pub(super) summarizer_model_id: String,
/// Shared `call_id -> (success, failure, elapsed_ms, output_chars)` side
/// channel: middleware records each outcome for the bridge's
/// `ToolCallCompleted`.
@@ -170,6 +173,7 @@ pub(super) fn install_turn_middleware(
run_mode,
memory_turn,
summarizer_model,
+ summarizer_model_id,
failure_map,
provider_usage_carry,
tool_outcome_sink,
@@ -478,6 +482,7 @@ pub(super) fn install_turn_middleware(
compaction.strategy,
microcompact_keep_recent,
summarizer_model,
+ &summarizer_model_id,
pause_at_cap && subagent_scope.is_none(),
&tool_outcome_sink,
memory_turn,