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(web_chat): cover late subagent failure after runner exit
Steven Enamakel790d33cd7e1b
diff --git a/crates/openhuman-core/src/threads/store/bus_tests.rs b/crates/openhuman-core/src/threads/store/bus_tests.rsindex 45b04211f4..718ac0e651 100644--- a/crates/openhuman-core/src/threads/store/bus_tests.rs+++ b/crates/openhuman-core/src/threads/store/bus_tests.rs@@ -37,11 +37,12 @@ async fn persists_inbound_and_processed_turns_into_workspace_thread() {inbound_envelope.conversation.scope_id = Some("T123".into());// The module owns the session-key format, so the expectation is built by the// same builder rather than spelled out.- let expected_session_key = tinychannels_runtime::channel::build_session_key_for_inbound_envelope(- "main",- &inbound_envelope,- Default::default(),- );+ let expected_session_key =+ tinychannels_runtime::channel::build_session_key_for_inbound_envelope(+ "main",+ &inbound_envelope,+ Default::default(),+ );subscriber.handle(&DomainEvent::ChannelMessageReceived {diff --git a/crates/openhuman-core/src/web_chat/turn_host_tests.rs b/crates/openhuman-core/src/web_chat/turn_host_tests.rsindex 892064c600..4f40cd8605 100644--- a/crates/openhuman-core/src/web_chat/turn_host_tests.rs+++ b/crates/openhuman-core/src/web_chat/turn_host_tests.rs@@ -130,6 +130,55 @@ async fn a_dropped_runner_stops_the_tap() {assert!(*drained_rx.borrow());}+/// A detached sub-agent that fails after its parent turn has finished (a child+/// aborted by `subagent_cancel`) still settles its card: the tap keeps running+/// past the runner and publishes the failure under the turn's ids.+#[tokio::test]+async fn a_late_subagent_failure_is_published_after_the_runner_is_gone() {+ let mut bus = crate::web_chat::subscribe_web_channel_events();+ let (agent_tx, agent_rx) = mpsc::channel(8);+ let (runner_tx, runner_rx) = mpsc::channel(1);+ let (drained_tx, _drained_rx) = watch::channel(false);+ let _tap = tap_progress(+ &DispatchCtx::ambient(),+ agent_rx,+ runner_tx,+ TurnActivity::default(),+ drained_tx,+ Some(LateSubagentSink {+ client_id: "late-client".into(),+ thread_id: "late-thread".into(),+ request_id: "late-request".into(),+ }),+ );+ drop(runner_rx);+ agent_tx.send(AgentProgress::TurnStarted).await.unwrap();+ agent_tx+ .send(AgentProgress::SubagentFailed {+ agent_id: "researcher".into(),+ task_id: "task-late".into(),+ error: "cancelled".into(),+ })+ .await+ .unwrap();+ let event = tokio::time::timeout(Duration::from_secs(5), async {+ loop {+ let event = bus.recv().await.expect("event bus");+ if event.context().request_id == "late-request" {+ return event;+ }+ }+ })+ .await+ .expect("the late failure is published");+ assert_eq!(event.event_name(), "subagent_failed");+ assert_eq!(event.context().client_id, "late-client");+ assert_eq!(event.context().thread_id, "late-thread");+ let wire = serde_json::to_value(&event).expect("wire event");+ assert_eq!(wire["skill_id"], "task-late");+ assert_eq!(wire["success"], false);+}+#[tokio::test]async fn the_heartbeat_beats_only_for_a_live_turn() {use super::super::surface::TurnIds;