Skip to content

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

chore: files changed crates/openhuman-core/src/agent/progress_tracing/langfuse/environment.rs,crates

Steven Enamakel083d8b1b83bb
diff --git a/crates/openhuman-core/src/agent/progress_tracing/langfuse/environment.rs b/crates/openhuman-core/src/agent/progress_tracing/langfuse/environment.rs
index 97d9ce8ca0..426305ef0f 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/langfuse/environment.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/langfuse/environment.rs
@@ -6,24 +6,16 @@ use crate::config::Config;
use super::LOG_TARGET;
-/// Backend proxy route for Langfuse ingestion (relative to the backend origin).
-/// The backend authenticates the caller's session JWT, injects the Langfuse
-/// project keys, and forwards to Langfuse's real `/api/public/ingestion` — so
-/// clients POST here, NOT to `/api/public/ingestion` (which is unexposed and
-/// carries no keys).
-const INGESTION_PATH: &str = "/telemetry/langfuse/ingestion";
-
-/// Resolve the Langfuse ingestion URL from the current backend host. Joins the
-/// proxy path onto [`crate::backend::base_url`] — the exact base-server
-/// resolution every other backend call uses — via the canonical
-/// [`crate::util::url::join_url`] helper, which replaces any path the base
-/// carried with the given absolute path. So the host always matches wherever the
-/// app's domain calls go (staging, prod, or a custom `api_url` override).
+/// The Langfuse ingestion URL the host resolved
+/// (`config.resolved_endpoints.tracing_ingest_url`), so the host always
+/// matches wherever the app's domain calls go (staging, prod, or a custom
+/// `api_url` override). Empty when no host resolved one; callers treat a
+/// non-`http` URL as "proxy unavailable" and skip the push.
pub(crate) fn ingestion_url(config: &Config) -> String {
- // Empty without a backend transport; callers treat a non-`http` URL as
- // "proxy unavailable" and skip the push.
- crate::backend::base_url(&config.api_url)
- .map(|base| crate::util::url::join_url(&base, INGESTION_PATH))
+ config
+ .resolved_endpoints
+ .tracing_ingest_url
+ .clone()
.unwrap_or_default()
}
diff --git a/crates/openhuman-core/src/agent/progress_tracing/otlp.rs b/crates/openhuman-core/src/agent/progress_tracing/otlp.rs
index a850ec2dae..5a3ecf816e 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/otlp.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/otlp.rs
@@ -35,11 +35,13 @@ pub(super) async fn push_spans(config: &Config, spans: &[TraceSpan]) -> Result<(
}
_ => return Ok(()),
};
- // Backend traffic: the transport's client carries the host's attribution
- // headers (product identity, versions).
- let client = crate::backend::resolve_backend_transport()
- .map_err(|err| format!("Langfuse OTLP push has no backend transport: {err}"))?
- .http_client(crate::backend::TransportProfile::Api);
+ // Backend traffic: stamp the host's attribution headers (product
+ // identity, versions) resolved onto the config.
+ let attribution = config.resolved_endpoints.attribution_header_map();
+ let client = reqwest::Client::builder()
+ .default_headers(attribution)
+ .build()
+ .map_err(|err| format!("Langfuse OTLP client build failed: {err}"))?;
for payload in otlp_requests(spans, environment, &super::export_brand()) {
let response = client
.post(&url)
diff --git a/crates/openhuman-core/src/core/runtime/services.rs b/crates/openhuman-core/src/core/runtime/services.rs
index 957b9e32bb..1428040248 100644
--- a/crates/openhuman-core/src/core/runtime/services.rs
+++ b/crates/openhuman-core/src/core/runtime/services.rs
@@ -490,7 +490,7 @@ pub fn spawn_socket_auto_connect(
services: ServiceSet,
socket_mgr: std::sync::Arc<crate::platform::socket::SocketManager>,
) {
- if services.socketio && crate::backend::transport::is_installed() {
+ if services.socketio {
tokio::spawn(async move {
log::info!("[socket] Checking for stored session to auto-connect...");
let config = match Config::load_or_init().await {
@@ -500,8 +500,8 @@ pub fn spawn_socket_auto_connect(
return;
}
};
- let Ok(api_url) = crate::backend::base_url(&config.api_url) else {
- log::debug!("[socket] No backend transport or base URL — skipping auto-connect");
+ let Some(api_url) = config.resolved_endpoints.control_plane_url.clone() else {
+ log::debug!("[socket] No resolved control plane — skipping auto-connect");
return;
};
let initial_token =
diff --git a/crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs b/crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs
index 761d44e177..1115dd7b3b 100644
--- a/crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs
@@ -44,7 +44,6 @@ const LOG_TARGET: &str = "flows::langfuse";
/// where flow traces go. The backend authenticates the session JWT, injects
/// the Langfuse project keys, and forwards to Langfuse's
/// `/api/public/otel/v1/traces`.
-const INGESTION_PATH: &str = "/telemetry/langfuse/ingestion";
/// Cap the push so a slow/hung Langfuse never stalls run teardown (same
/// posture as the agent-turn exporter).
const PUSH_TIMEOUT: Duration = Duration::from_secs(10);
@@ -54,10 +53,12 @@ const PUSH_TIMEOUT: Duration = Duration::from_secs(10);
/// always matches wherever the app's domain calls go (staging, prod, or a
/// custom `api_url` override).
fn ingestion_url(config: &Config) -> String {
- // Empty without a backend transport; callers treat a non-`http` URL as
- // "proxy unavailable" and skip the push.
- crate::backend::base_url(&config.api_url)
- .map(|base| crate::util::url::join_url(&base, INGESTION_PATH))
+ // Empty without a resolved ingestion URL; callers treat a non-`http` URL
+ // as "proxy unavailable" and skip the push.
+ config
+ .resolved_endpoints
+ .tracing_ingest_url
+ .clone()
.unwrap_or_default()
}
diff --git a/crates/openhuman-core/src/platform/socket/ops.rs b/crates/openhuman-core/src/platform/socket/ops.rs
index f78e426294..2272d68623 100644
--- a/crates/openhuman-core/src/platform/socket/ops.rs
+++ b/crates/openhuman-core/src/platform/socket/ops.rs
@@ -56,7 +56,7 @@ pub async fn connect_with_session(
) -> Result<SocketState, String> {
log::info!("[socket:rpc] connect_with_session — resolving credentials");
let config = std::sync::Arc::new(ctx.load_config().await?);
- let api_url = crate::backend::require_base_url(&config.api_url)?;
+ let api_url = config.resolved_endpoints.require_control_plane()?.to_string();
let token = crate::security::credentials::session_support::get_session_token(&config)
.map_err(|e| format!("failed to read session token: {e}"))?
.ok_or("no session token stored — user must log in first")?;
diff --git a/crates/openhuman-core/src/security/credentials/session_support.rs b/crates/openhuman-core/src/security/credentials/session_support.rs
index 0ef5e1f199..2e5a925db8 100644
--- a/crates/openhuman-core/src/security/credentials/session_support.rs
+++ b/crates/openhuman-core/src/security/credentials/session_support.rs
@@ -277,8 +277,10 @@ fn check_session_backend(config: &Config, profile: Option<&AuthProfile>) -> Resu
let Some(issuing) = profile.metadata.get(SESSION_ISSUING_BACKEND_META) else {
return Ok(());
};
- let matches = crate::backend::base_url(&config.api_url)
- .ok()
+ let matches = config
+ .resolved_endpoints
+ .control_plane_url
+ .clone()
.and_then(|base| normalize_session_backend(&base).ok())
.zip(normalize_session_backend(issuing).ok())
.is_some_and(|(current, issuing)| current == issuing);
@@ -464,8 +466,8 @@ pub fn resolve_backend_credential(config: &Config) -> Result<BackendCredential,
/// Resolve a credential for a direct call to the configured backend.
/// A missing transport or unusable credential is an expected offline state.
pub fn direct_backend_credential(config: &Config, op: &str) -> Option<BackendCredential> {
- if !crate::backend::transport::is_installed() {
- log::debug!("[backend-direct] {op} skipped: no backend transport installed");
+ if config.resolved_endpoints.control_plane_url.is_none() {
+ log::debug!("[backend-direct] {op} skipped: no control plane resolved");
return None;
}
match resolve_backend_credential(config) {