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(agent): assert trace lineage via span ids instead of attributes
Steven Enamakelaee1841b5e57
diff --git a/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs b/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rsindex e7ccbe91b2..fc6fa90482 100644--- a/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/driver/grounded_close_tests.rs@@ -263,14 +263,34 @@ async fn supplemental_close_call_emits_native_start_and_actual_completion() {assert_eq!(text, "supplemental answer");assert!(usage.is_none());let records = recorder.0.lock().unwrap();- assert!(matches!(records.as_slice(), [- AgentEvent::ModelStarted { call_id: started, model },- AgentEvent::ModelCompleted { call_id: completed, input: Some(input), output: Some(output), .. },- ] if started == completed- && started.as_str() == "host-supplemental-fixture-host-supplemental-1"- && model == "gpt-4.1"- && input.to_string().contains("supplemental prompt")- && output.to_string().contains("supplemental answer")));+ let started = records+ .iter()+ .find_map(|event| match event {+ AgentEvent::ModelStarted { call_id, model } => {+ assert_eq!(model, "gpt-4.1");+ Some(call_id)+ }+ _ => None,+ })+ .expect("supplemental source emits a typed start");+ assert_eq!(+ started.as_str(),+ "host-supplemental-fixture-host-supplemental-1"+ );+ assert!(+ records.iter().any(|event| matches!(+ event,+ AgentEvent::ModelCompleted {+ call_id,+ input: Some(input),+ output: Some(output),+ ..+ } if call_id == started+ && input.to_string().contains("supplemental prompt")+ && output.to_string().contains("supplemental answer")+ )),+ "the source response is journaled with its actual IO"+ );}#[test]diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_trace_export_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_trace_export_tests.rsindex eb90d61faf..79372ab1bd 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_trace_export_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_trace_export_tests.rs@@ -192,6 +192,16 @@ async fn prepared_child_run_is_exported_from_its_native_journal_lineage() {.saturating_add(1),);let spans = collector.spans();+ let root_span = spans+ .iter()+ .find(|span| {+ span.kind == tinyagents_harness::observability::trace_export::SpanKind::Turn+ && span+ .attributes+ .get("run.id")+ .is_some_and(|id| id == root_run_id.as_str())+ })+ .expect("the root run is represented by the trace turn span");let child_span = spans.iter().find(|span| {@@ -200,8 +210,12 @@ async fn prepared_child_run_is_exported_from_its_native_journal_lineage() {.is_some_and(|id| id == child_run_id.as_str())}).expect("native collector projects the actual linked child");- assert_eq!(child_span.attributes["parent_run_id"], root_run_id.as_str());- assert_eq!(child_span.attributes["root_run_id"], root_run_id.as_str());+ assert_eq!(+ child_span.parent_span_id.as_deref(),+ Some(root_span.span_id.as_str())+ );+ assert_eq!(root_span.attributes["parent_run_id"], root_run_id.as_str());+ assert_eq!(root_span.attributes["root_run_id"], root_run_id.as_str());let generation = spans.iter().find(|span| {