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(subagent-host): add checkpoint test module
Steven Enamakelea0d3c883a88
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/checkpoint.rs b/crates/openhuman-core/src/agent/subagent_host/ops/checkpoint.rsindex f210afbb6d..8072f8f911 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/checkpoint.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/checkpoint.rs@@ -103,3 +103,7 @@ impl CapSummaryModel for HostCapSummaryModel<'_> {}}}++#[cfg(test)]+#[path = "checkpoint_tests.rs"]+mod tests;diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/checkpoint_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops/checkpoint_tests.rsnew file mode 100644index 0000000000..c13bcd9af3--- /dev/null+++ b/crates/openhuman-core/src/agent/subagent_host/ops/checkpoint_tests.rs@@ -0,0 +1,74 @@+use super::*;+use tinyagents_harness::events::{AgentEvent, EventListener, EventRecord, EventSink};+use tinyagents_harness::ids::RunId;+use tinyagents_harness::summarization::CapToolResult;+use tinyinference_llm::model::{ModelProfile, ModelResponse};++#[derive(Default)]+struct Recorder(std::sync::Mutex<Vec<AgentEvent>>);++impl EventListener for Recorder {+ fn on_event(&self, record: &EventRecord) {+ self.0.lock().unwrap().push(record.event.clone());+ }+}++struct FailingSummaryModel;++#[async_trait::async_trait]+impl ChatModel<()> for FailingSummaryModel {+ fn profile(&self) -> Option<&ModelProfile> {+ None+ }++ async fn invoke(+ &self,+ _state: &(),+ _request: ModelRequest,+ ) -> tinyinference_llm::Result<ModelResponse> {+ Err(tinyinference_llm::Error::Model(+ "scripted cap summary failure".into(),+ ))+ }+}++#[tokio::test]+async fn failed_cap_summary_is_traced_and_keeps_deterministic_fallback() {+ let run_id = RunId::new("native-child-cap");+ let events = EventSink::with_stream_id(run_id.as_str());+ let recorder = Arc::new(Recorder::default());+ events.subscribe(recorder.clone());+ let checkpoint = SubagentCheckpoint {+ chat_model: Arc::new(FailingSummaryModel),+ agent_id: "researcher".into(),+ model: "claude-opus-4-8".into(),+ max_output_tokens: 64,+ trace: Some(crate::agent::tinyagents::SupplementalTrace::new(+ events,+ run_id,+ )),+ };+ let results = [CapToolResult {+ call_id: "call-1",+ name: "read_file",+ output: "found a useful source",+ success: true,+ }];++ let summary = checkpoint+ .summarize_cap_hit(&results, 2)+ .await+ .expect("owner fallback preserves a successful checkpoint");+ assert!(summary.text.contains("tool-call limit (2 steps)"));+ assert!(summary.text.contains("read_file [ok]: found a useful source"));+ assert!(summary.usage.is_none());++ let records = recorder.0.lock().unwrap();+ assert!(matches!(records.as_slice(), [+ AgentEvent::ModelStarted { call_id: started, model },+ AgentEvent::ModelFailed { call_id: failed, model: failed_model, .. },+ ] if started == failed+ && started.as_str() == "native-child-cap-host-supplemental-1"+ && model == "claude-opus-4-8"+ && failed_model == model));+}