Skip to content

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

test: resolve tracing and control plane endpoints from resolved_endpoints

Steven Enamakelb9a70fc2a5b4
diff --git a/crates/openhuman-core/src/agent/progress_tracing/langfuse_batch_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/langfuse_batch_tests.rs
index 7bcc9b2588..11a056c57f 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/langfuse_batch_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/langfuse_batch_tests.rs
@@ -37,25 +37,14 @@ fn every_environment_for_base_bucket_is_classified_deliberately() {
}
#[test]
-fn ingestion_url_uses_backend_origin_and_ingestion_path() {
+fn ingestion_url_is_the_host_resolved_tracing_endpoint() {
let mut config = Config::default();
- config.api_url = Some("https://staging-api.tinyhumans.ai/api/v1".to_string());
+ assert_eq!(ingestion_url(&config), "", "nothing resolved means no push");
+ config.resolved_endpoints.tracing_ingest_url =
+ Some("https://staging-api.tinyhumans.ai/telemetry/langfuse/ingestion".to_string());
assert_eq!(
ingestion_url(&config),
- "https://staging-api.tinyhumans.ai/telemetry/langfuse/ingestion",
- "endpoint is the backend's Langfuse proxy route on the base server \
- host, replacing any inference path the base carried"
- );
-
- // A base carrying an inference path resolves to the proxy route on the
- // SAME host — the ingestion host tracks the base server URL, not a fixed
- // literal.
- let mut with_inference_path = Config::default();
- with_inference_path.api_url =
- Some("https://api.tinyhumans.ai/openai/v1/chat/completions".to_string());
- assert_eq!(
- ingestion_url(&with_inference_path),
- "https://api.tinyhumans.ai/telemetry/langfuse/ingestion"
+ "https://staging-api.tinyhumans.ai/telemetry/langfuse/ingestion"
);
}
diff --git a/crates/openhuman-core/src/flows/tinyflows/langfuse_export_tests.rs b/crates/openhuman-core/src/flows/tinyflows/langfuse_export_tests.rs
index 50dc874b2f..a0d05332d7 100644
--- a/crates/openhuman-core/src/flows/tinyflows/langfuse_export_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/langfuse_export_tests.rs
@@ -75,7 +75,8 @@ fn find_span<'a>(batch: &'a [Value], id: &str) -> Option<&'a Value> {
#[test]
fn ingestion_url_targets_backend_proxy_route() {
let mut config = Config::default();
- config.api_url = Some("https://staging-api.tinyhumans.ai/api/v1".to_string());
+ config.resolved_endpoints.tracing_ingest_url =
+ Some("https://staging-api.tinyhumans.ai/telemetry/langfuse/ingestion".to_string());
assert_eq!(
ingestion_url(&config),
"https://staging-api.tinyhumans.ai/telemetry/langfuse/ingestion"
@@ -85,7 +86,8 @@ fn ingestion_url_targets_backend_proxy_route() {
#[test]
fn flow_export_targets_the_v4_otlp_proxy_route() {
let mut config = Config::default();
- config.api_url = Some("https://staging-api.tinyhumans.ai/api/v1".to_string());
+ config.resolved_endpoints.tracing_ingest_url =
+ Some("https://staging-api.tinyhumans.ai/telemetry/langfuse/ingestion".to_string());
let client = LangfuseClient::new(
ingestion_url(&config),
LangfuseAuth::Bearer {
diff --git a/crates/openhuman-core/src/platform/socket/ops.rs b/crates/openhuman-core/src/platform/socket/ops.rs
index 2272d68623..13621bf5ba 100644
--- a/crates/openhuman-core/src/platform/socket/ops.rs
+++ b/crates/openhuman-core/src/platform/socket/ops.rs
@@ -56,7 +56,10 @@ 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 = config.resolved_endpoints.require_control_plane()?.to_string();
+ 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_tests.rs b/crates/openhuman-core/src/security/credentials/session_support_tests.rs
index d9ab768d33..1f7263c509 100644
--- a/crates/openhuman-core/src/security/credentials/session_support_tests.rs
+++ b/crates/openhuman-core/src/security/credentials/session_support_tests.rs
@@ -19,6 +19,7 @@ fn bound_session_token_release_requires_issuing_backend() {
let tmp = TempDir::new().unwrap();
let mut config = test_config(&tmp);
config.api_url = Some("https://issuer.example/".into());
+ config.resolved_endpoints.control_plane_url = Some("https://issuer.example".into());
let mut metadata = std::collections::HashMap::new();
metadata.insert(
SESSION_ISSUING_BACKEND_META.into(),
@@ -47,6 +48,7 @@ fn bound_session_token_release_requires_issuing_backend() {
Some("https://issuer.example")
);
config.api_url = Some("https://different.example".into());
+ config.resolved_endpoints.control_plane_url = Some("https://different.example".into());
assert!(get_session_token(&config)
.unwrap_err()
.starts_with("SESSION_BACKEND_MISMATCH"));
diff --git a/crates/openhuman-core/src/tinymemes/jev_tests.rs b/crates/openhuman-core/src/tinymemes/jev_tests.rs
index 87fbf708ac..797cf90659 100644
--- a/crates/openhuman-core/src/tinymemes/jev_tests.rs
+++ b/crates/openhuman-core/src/tinymemes/jev_tests.rs
@@ -17,7 +17,8 @@ fn without_a_backend_credential_managed_jev_is_unavailable() {
#[test]
fn an_api_key_reaches_managed_jev() {
let dir = tempfile::tempdir().unwrap();
- let config = config_in(dir.path());
+ let mut config = config_in(dir.path());
+ config.resolved_endpoints.control_plane_url = Some("https://api.example.test".into());
crate::security::credentials::api_key::store_api_key(&config, "th_live_test").unwrap();
assert!(managed(&config).is_some());
}