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
test(tinyagents): cover summarizer model in compaction provenance
Steven Enamakeld7906c4eb41a
diff --git a/crates/openhuman-core/src/agent/tinyagents/context_wiring_tests.rs b/crates/openhuman-core/src/agent/tinyagents/context_wiring_tests.rsindex 533148f39d..eca0963169 100644--- a/crates/openhuman-core/src/agent/tinyagents/context_wiring_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/context_wiring_tests.rs@@ -72,3 +72,59 @@ async fn merging_summaries_is_not_announced_again() {let _ = summarizer.merge(&[]).await;assert_eq!(*calls.lock().unwrap(), ["merge"]);}++/// A compaction names the summarizer's own model in its provenance, not the+/// turn's: with `[context] summarizer_model` set the two differ.+#[tokio::test]+async fn a_compaction_records_the_summarizer_model_it_called() {+ use tinyagents_harness::context::{RunConfig, RunContext};+ use tinyagents_harness::testkit::ScriptedModel;++ let state_model = Arc::new(ScriptedModel::replies(vec![+ "{\"goal\": \"keep going\"}";+ 4+ ]));+ let mw = Arc::new(compression_middleware(+ SummarizationPolicy::default().with_trigger_override(200),+ crate::config::CompactionStrategy::TaskState,+ None,+ state_model,+ "scaledown/summarize",+ "turn-model",+ None,+ None,+ ));+ let mut harness: AgentHarness<()> = AgentHarness::new();+ harness.with_model_resolver(Arc::new(+ tinyagents_harness::host::FixedModelResolver::named(+ "turn-model",+ Arc::new(ScriptedModel::replies(vec!["done"])) as _,+ ),+ ));+ harness.push_middleware(mw.clone());+ harness.push_model_middleware(mw.clone());++ let mut history = vec![Message::system("system")];+ for round in 0..6 {+ history.push(Message::user(format!("ask {round}: {}", "detail ".repeat(60))));+ history.push(Message::assistant(format!(+ "answer {round}: {}",+ "result ".repeat(60)+ )));+ }+ history.push(Message::user("continue"));+ harness+ .invoke_in_context(&(), RunContext::new(RunConfig::new("compaction"), ()), history)+ .await+ .expect("the turn runs");++ let records = mw.records();+ assert!(!records.is_empty(), "the turn compacted");+ for record in records {+ assert!(+ record.provenance.reason.contains("via scaledown/summarize"),+ "{}",+ record.provenance.reason+ );+ }+}