Skip to content

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

fix(tracing): check push gates before reading a child's journal

M3gA-Mind5b50c5371115
diff --git a/crates/openhuman-core/src/agent/progress_tracing/export.rs b/crates/openhuman-core/src/agent/progress_tracing/export.rs
index 9cf849c642..ada0ff6fca 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/export.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/export.rs
@@ -139,6 +139,15 @@ pub(crate) async fn export_subagent_journal_trace(
if !config.observability.share_usage_data {
return;
}
+ // Check the push gates before reading the child's journal: without a live
+ // session the push refuses anyway, and the read and observation build were
+ // pure cost — on every delegated turn, since usage sharing defaults on.
+ if !langfuse::journal_push_ready(config) {
+ log::debug!(
+ "[agent-tracing] child trace export skipped: push not possible run_id={journal_run_id}"
+ );
+ return;
+ }
let observations = match crate::agent::tinyagents::journal::read_run_events(journal_run_id, 0)
.await
{
diff --git a/crates/openhuman-core/src/agent/progress_tracing/langfuse.rs b/crates/openhuman-core/src/agent/progress_tracing/langfuse.rs
index 98ddb58ca7..561792d01c 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/langfuse.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/langfuse.rs
@@ -24,8 +24,8 @@ mod journal_export;
mod span_export;
pub(crate) use environment::{environment_for_base, ingestion_url};
-pub(crate) use journal_export::push_observations;
pub(crate) use journal_export::root_subagent_observations;
+pub(crate) use journal_export::{journal_push_ready, push_observations};
pub(crate) use span_export::push_spans;
use super::{SpanStatus, TraceContext, TraceSpan};
diff --git a/crates/openhuman-core/src/agent/progress_tracing/langfuse/journal_export.rs b/crates/openhuman-core/src/agent/progress_tracing/langfuse/journal_export.rs
index 55601cee89..a74c604a28 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/langfuse/journal_export.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/langfuse/journal_export.rs
@@ -243,6 +243,18 @@ pub(super) fn insert_run_telemetry_generation(
/// exporter. The journal is already redacted before persistence, and this
/// exporter additionally strips model/tool payloads unless `capture_content`
/// is explicitly enabled.
+/// Whether [`push_observations`] would actually send for `config`: the same
+/// gates it checks, for a caller that must read a journal and build
+/// observations first. Without a live session (unit tests, a signed-out or
+/// embedder host) or on a skipped environment, that work is discarded
+/// anyway — and reading a whole child journal is not free.
+pub(crate) fn journal_push_ready(config: &Config) -> bool {
+ let url = ingestion_url(config);
+ !skip_push(environment_for_base(&url))
+ && url.starts_with("http")
+ && require_live_session_token(config).is_ok()
+}
+
pub(crate) async fn push_observations(
config: &Config,
trace_ctx: &TraceContext,