Skip to content

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

fix(security): remove unused langfuse and otlp modules

Steven Enamakel3a8ce35878a8
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 a74c604a28..96e6f8d70a 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
@@ -252,7 +252,7 @@ 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()
+ && direct_backend_credential(config, "langfuse journal push").is_some()
}
pub(crate) async fn push_observations(
@@ -276,7 +276,13 @@ pub(crate) async fn push_observations(
"could not resolve Langfuse ingestion URL from backend host (got {url:?})"
));
}
- let token = require_live_session_token(config)?;
+ // No TinyHumans connection, or no usable credential (signed out, offline
+ // local session): a configured state, so skip quietly rather than failing
+ // every turn's push.
+ let Some(credential) = direct_backend_credential(config, "langfuse journal push") else {
+ return Ok(());
+ };
+ let token = credential.into_secret();
// Stamp the run lineage from the run's own observations so a spawned
// sub-agent's trace links back to its parent turn (#4657).
let trace_ctx = trace_ctx_with_run_lineage(trace_ctx, observations);
diff --git a/crates/openhuman-core/src/agent/progress_tracing/langfuse/span_export.rs b/crates/openhuman-core/src/agent/progress_tracing/langfuse/span_export.rs
index dd40378eae..3e8dad6a47 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/langfuse/span_export.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/langfuse/span_export.rs
@@ -259,7 +259,13 @@ pub(crate) async fn push_spans(config: &Config, spans: &[TraceSpan]) -> Result<(
"could not resolve Langfuse ingestion URL from backend host (got {url:?})"
));
}
- let token = require_live_session_token(config)?;
+ // No TinyHumans connection, or no usable credential (signed out, offline
+ // local session): a configured state, so skip quietly rather than failing
+ // every turn's push.
+ let Some(credential) = direct_backend_credential(config, "langfuse span push") else {
+ return Ok(());
+ };
+ let token = credential.into_secret();
let include_content = config.observability.agent_tracing.capture_content;
let batch = spans_to_langfuse_batch(spans, include_content, environment);
let span_count = spans.len();
diff --git a/crates/openhuman-core/src/agent/progress_tracing/otlp.rs b/crates/openhuman-core/src/agent/progress_tracing/otlp.rs
index 6b42cba171..036ab63faa 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/otlp.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/otlp.rs
@@ -459,7 +459,13 @@ pub(super) async fn push_spans(config: &Config, spans: &[TraceSpan]) -> Result<(
if !url.starts_with("http") {
return Err("Langfuse backend proxy URL is unavailable".to_string());
}
- let token = require_live_session_token(config)?;
+ // No TinyHumans connection, or no usable credential (signed out, offline
+ // local session): a configured state, so skip quietly rather than failing
+ // every turn's push.
+ let Some(credential) = direct_backend_credential(config, "langfuse otlp push") else {
+ return Ok(());
+ };
+ let token = credential.into_secret();
let (product_header, product_value) = crate::api::product::product_identity_header();
let client = reqwest::Client::new();
for payload in otlp_requests(spans, environment) {
diff --git a/crates/openhuman-core/src/security/credentials/session_support.rs b/crates/openhuman-core/src/security/credentials/session_support.rs
index bae31eb0f5..30927f49e1 100644
--- a/crates/openhuman-core/src/security/credentials/session_support.rs
+++ b/crates/openhuman-core/src/security/credentials/session_support.rs
@@ -393,6 +393,31 @@ pub fn resolve_backend_credential(config: &Config) -> Result<BackendCredential,
}
}
+/// The credential for a backend call that talks to the backend host directly
+/// rather than through the transport port (Langfuse proxy push, channel reply
+/// relay, …), or `None` when the call should be skipped:
+///
+/// - no backend transport is installed — the core runs without a TinyHumans
+/// connection (`api::transport::is_installed`), or
+/// - no usable credential resolves — signed out, the offline local session,
+/// or a locally-expired token ([`resolve_backend_credential`]).
+///
+/// Both are configured states, not faults, so the skip is logged at `debug`
+/// with `op` naming the caller; nothing reaches Sentry and no request is made.
+pub fn direct_backend_credential(config: &Config, op: &str) -> Option<BackendCredential> {
+ if !crate::api::transport::is_installed() {
+ log::debug!("[backend-direct] {op} skipped: no backend transport installed");
+ return None;
+ }
+ match resolve_backend_credential(config) {
+ Ok(credential) => Some(credential),
+ Err(reason) => {
+ log::debug!("[backend-direct] {op} skipped: no usable backend credential ({reason})");
+ None
+ }
+ }
+}
+
/// Whether *some* backend credential is present — an API key or a non-empty
/// app-session token — without classifying expiry. This is the boot-time
/// "signed in?" question the scheduler gate asks: an expired session still