Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(observability): cover child export sharing and readiness gates

Steven Enamakel8a2a316e68fc
diff --git a/crates/openhuman-core/src/agent/tinyagents/journal.rs b/crates/openhuman-core/src/agent/tinyagents/journal.rs
index 9ffd7a4f02..1ccbc12678 100644
--- a/crates/openhuman-core/src/agent/tinyagents/journal.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/journal.rs
@@ -57,9 +57,8 @@ use tinyagents_harness::observability::{
use tinyagents_harness::store::AppendStore;
-/// Best-effort live request → durable tinyagents journal stream map. The web
-/// progress bridge uses this at turn end to shadow-project spans from the
-/// journal and compare them against the live `SpanCollector` path during C4 S3.
+/// Best-effort request-to-run map used by the web bridge to collect the
+/// completed run's durable native observations for export.
fn request_journal_runs(ctx: &DispatchCtx) -> std::sync::Arc<RequestJournalRuns> {
crate::core::runtime::slot_for::<RequestJournalRuns>(ctx)
}
@@ -278,10 +277,8 @@ pub(crate) async fn attach_turn_journal(
/// whose stream offset is `>= from_offset`, in order. Reading from `0` replays
/// the whole run.
///
-/// This is the seam a future replay RPC (05.x) will call so the desktop can
-/// reconnect mid-run and backfill the timeline from durable state instead of
-/// relying on transient `AgentProgress` buffering. Best-effort: a missing store
-/// or unknown run yields an empty `Vec`, not an error.
+/// Export and host readers use this to replay a durable run from its first
+/// event. Best-effort: a missing store or unknown run yields an empty `Vec`.
pub(crate) async fn read_run_events(
ctx: &DispatchCtx,
run_id: &str,
diff --git a/crates/openhuman-core/src/core/observability/progress_tracing/export_tests.rs b/crates/openhuman-core/src/core/observability/progress_tracing/export_tests.rs
index 189cd033a7..d493dae63a 100644
--- a/crates/openhuman-core/src/core/observability/progress_tracing/export_tests.rs
+++ b/crates/openhuman-core/src/core/observability/progress_tracing/export_tests.rs
@@ -107,3 +107,31 @@ async fn external_backend_is_skipped_before_session_lookup() {
}];
assert!(push_spans(&config, &spans).await.is_ok());
}
+
+#[tokio::test]
+async fn child_export_obeys_sharing_and_readiness_gates_before_reading() {
+ let dispatch = crate::core::runtime::DispatchCtx::ambient();
+ let mut config = Config::default();
+ crate::core::observability::progress_tracing::export_subagent_journal_trace(
+ &dispatch,
+ &config,
+ "missing-child-run",
+ None,
+ "worker",
+ "task-1",
+ )
+ .await;
+
+ config.observability.share_usage_data = true;
+ config.api_url = Some("https://external.invalid/api".into());
+ assert!(!crate::backend::telemetry::langfuse::journal_push_ready(&config));
+ crate::core::observability::progress_tracing::export_subagent_journal_trace(
+ &dispatch,
+ &config,
+ "missing-child-run",
+ None,
+ "worker",
+ "task-1",
+ )
+ .await;
+}