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(agent): move deadline wind-down tests into their own module
Steven Enamakel1eb54486df65
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rsindex bdff79b51f..9b09206d5d 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs@@ -52,6 +52,55 @@ async fn committed_progress_uses_each_turns_receipt_sender() {drop(first);}+/// A turn the harness stopped early (here: the failure breaker) still commits+/// through `after_commit`. The stop the driver recorded on the turn's sidecar+/// must ride on `TurnCompleted`, or the trace closes the turn as a clean+/// completion and nobody can find it.+#[tokio::test]+async fn committed_progress_carries_the_sidecar_stop_on_turn_completed() {+ use crate::agent::progress::AgentProgress;+ use crate::agent::turn_stop::{TurnStop, TurnStopKind};+ use tinyagents_runtime::{+ CommitReceipt, ResumeMode, SessionTurnOutcome, TranscriptTurnOptions,+ };++ let (tx, mut rx) = tokio::sync::mpsc::channel(4);+ let mut context = crate::agent::tinyagents::host::OpenHumanRunContext::new();+ context.progress = Some(tx);+ context.session_sidecar.lock().unwrap().stop = Some(TurnStop::breaker(+ "Stopping after 2 attempt(s): failure class `uncertain_side_effect` still blocks \+ operation `web_answer_tool` on `x`. Resolve this blocker before retrying.",+ ));+ let receipt = CommitReceipt {+ outcome: SessionTurnOutcome {+ history: Vec::new(),+ output: Some("I stopped this turn early".into()),+ interrupted: false,+ },+ options: TranscriptTurnOptions {+ request_id: None,+ thread_id: None,+ stream: true,+ resume: ResumeMode::Never,+ context,+ },+ transcript: None,+ };++ assert!(super::progress::send_receipt_progress(&receipt, "q", "a", 3).await);+ let mut completed = None;+ while let Ok(event) = rx.try_recv() {+ if let AgentProgress::TurnCompleted { stop, .. } = event {+ completed = Some(stop);+ }+ }+ let stop = completed+ .expect("TurnCompleted delivered")+ .expect("TurnCompleted carries the stop");+ assert_eq!(stop.kind, TurnStopKind::Breaker);+ assert_eq!(stop.operation.as_deref(), Some("web_answer_tool"));+}+#[test]fn clearing_progress_releases_warm_prelude_sender() {let tmp = tempfile::tempdir().expect("tempdir");diff --git a/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down_tests.rs b/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down_tests.rsindex 4118af5d26..6763598166 100644--- a/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/deadline_wind_down_tests.rs@@ -91,3 +91,25 @@ fn install_leaves_children_and_unbounded_turns_alone() {assert!(install_for(&mut plain, Some(&h), None, false).is_none());assert_eq!(plain.policy().limits.max_wall_clock_ms, before);}++/// The wind-down pause is how the turn ended, so it must reach the session+/// sidecar the driver classifies the turn's stop from. Before, the middleware+/// only paused, and a wound-down turn was traced as a clean completion.+#[test]+fn a_wind_down_pause_is_recorded_on_the_turn_sidecar() {+ let mut harness: AgentHarness<(), OpenHumanRunContext> = AgentHarness::new();+ harness.with_policy(crate::agent::tinyagents::run_policy_for(200, false));+ let now = Instant::now();+ let mut run_context = OpenHumanRunContext::new();+ run_context.turn_deadline = Some(TurnDeadline::new(+ now - Duration::from_secs(781),+ Duration::from_secs(900),+ ));+ let mw = install(&mut harness, &Some(handle()), &run_context, &None).expect("installed");+ assert!(!run_context.session_sidecar.lock().unwrap().wind_down);+ assert!(mw.maybe_pause("after_tool", Instant::now()));+ assert!(+ run_context.session_sidecar.lock().unwrap().wind_down,+ "the pause must be visible to the driver"+ );+}