Skip to content

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

fix(progress_tracing): correct Langfuse export to use structured output schema

Steven Enamakel63ab95c0302a
diff --git a/crates/openhuman-core/src/agent/progress_tracing/langfuse.rs b/crates/openhuman-core/src/agent/progress_tracing/langfuse.rs
index 203af6d02d..e72d566354 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/langfuse.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/langfuse.rs
@@ -19,7 +19,6 @@
use std::time::Duration;
mod environment;
-#[allow(dead_code)] // Legacy batch exporter remains for compatibility tests.
mod ingestion_batch;
#[allow(dead_code)] // Child-run rooting is still shared with the OTLP path.
mod journal_export;
diff --git a/crates/openhuman-core/src/agent/progress_tracing/types.rs b/crates/openhuman-core/src/agent/progress_tracing/types.rs
index 19ae7d0754..3866fe850e 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/types.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/types.rs
@@ -214,9 +214,8 @@ pub enum SpanStatus {
/// #4469 item 13: this raw record is **not** directly Langfuse-ingestible — the
/// Langfuse `/api/public/ingestion` API needs each span wrapped in a
/// `{ type, id, timestamp, body }` event envelope. That envelope is produced
-/// only by [`super::langfuse::spans_to_langfuse_batch`] on the remote-push path; the
-/// local NDJSON exporter intentionally emits the raw spans, not the batch
-/// format.
+/// only on the remote-push path (`otlp::push_spans`); the local NDJSON exporter
+/// intentionally emits the raw spans, not the batch format.
#[derive(Debug, Clone, Serialize)]
pub struct TraceSpan {
/// Trace id (the session id) — shared by every span in the run.
diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/ops_schema_and_structured_output_tests.rs b/crates/openhuman-core/src/flows/tinyflows/caps/ops_schema_and_structured_output_tests.rs
index 03c23d0ef5..ba351dccdb 100644
--- a/crates/openhuman-core/src/flows/tinyflows/caps/ops_schema_and_structured_output_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/caps/ops_schema_and_structured_output_tests.rs
@@ -1,127 +1,5 @@
use super::*;
-#[test]
-fn unsupported_arg_names_empty_when_every_name_is_a_real_property() {
- let schema = json!({
- "type": "object",
- "properties": { "channel": {"type": "string"}, "markdown_text": {"type": "string"} }
- });
- let args = json!({ "channel": "#general", "markdown_text": "hi" });
- assert_eq!(unsupported_arg_names(Some(&schema), &args), Some(vec![]));
-}
-
-#[test]
-fn unsupported_arg_names_skips_when_schema_is_none() {
- let args = json!({ "anything": "goes" });
- assert_eq!(unsupported_arg_names(None, &args), None);
-}
-
-#[test]
-fn unsupported_arg_names_skips_when_schema_has_no_properties_object() {
- // Legacy/loose schema shape (no `properties` map at all) — nothing to
- // validate names against, so this must skip, not reject.
- let schema = json!({ "type": "object", "description": "legacy shape" });
- let args = json!({ "anything": "goes" });
- assert_eq!(unsupported_arg_names(Some(&schema), &args), None);
-}
-
-#[test]
-fn unsupported_arg_names_skips_when_additional_properties_is_true() {
- let schema = json!({
- "type": "object",
- "properties": { "channel": {"type": "string"} },
- "additionalProperties": true
- });
- let args = json!({ "channel": "#general", "any_extra_field": "hi" });
- assert_eq!(unsupported_arg_names(Some(&schema), &args), None);
-}
-
-#[test]
-fn unsupported_arg_names_empty_for_null_or_non_object_args() {
- let schema = json!({
- "type": "object",
- "properties": { "channel": {"type": "string"} }
- });
- assert_eq!(
- unsupported_arg_names(Some(&schema), &Value::Null),
- Some(vec![])
- );
- assert_eq!(
- unsupported_arg_names(Some(&schema), &json!("not an object")),
- Some(vec![])
- );
-}
-
-// ── compute_primary_array_path ──────────────────────────────────────────
-
-#[test]
-fn compute_primary_array_path_finds_a_top_level_array_property() {
- let schema = json!({
- "type": "object",
- "properties": { "items": { "type": "array" }, "count": { "type": "integer" } }
- });
- assert_eq!(
- compute_primary_array_path(Some(&schema)),
- Some("items".to_string())
- );
-}
-
-#[test]
-fn compute_primary_array_path_finds_a_nested_array_property() {
- // Gmail-shaped: the array lives two levels down, under `data.messages`.
- let schema = json!({
- "type": "object",
- "properties": {
- "data": {
- "type": "object",
- "properties": {
- "messages": { "type": "array" },
- "nextPageToken": { "type": "string" }
- }
- }
- }
- });
- assert_eq!(
- compute_primary_array_path(Some(&schema)),
- Some("data.messages".to_string())
- );
-}
-
-#[test]
-fn compute_primary_array_path_prefers_the_shallowest_array() {
- // A top-level array (`items`) must win over a deeper one
- // (`data.nested`) even though `data` is declared first.
- let schema = json!({
- "type": "object",
- "properties": {
- "data": {
- "type": "object",
- "properties": { "nested": { "type": "array" } }
- },
- "items": { "type": "array" }
- }
- });
- assert_eq!(
- compute_primary_array_path(Some(&schema)),
- Some("items".to_string())
- );
-}
-
-#[test]
-fn compute_primary_array_path_none_when_absent_or_no_array_property() {
- assert_eq!(compute_primary_array_path(None), None);
- assert_eq!(
- compute_primary_array_path(Some(&json!({ "type": "object" }))),
- None
- );
- assert_eq!(
- compute_primary_array_path(Some(
- &json!({ "type": "object", "properties": { "id": { "type": "string" } } })
- )),
- None
- );
-}
-
// ── resolve_completion_model raw/BYOK passthrough (issue #4598) ───────────
#[test]
fn resolve_completion_model_forwards_raw_byok_node_model_verbatim() {
diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs b/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs
index adc79aa4cc..0e5cb935ee 100644
--- a/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs
@@ -629,16 +629,3 @@ fn response_fields_from_schema_empty_for_none_or_non_object() {
// Direct unit tests for the pure name-validity check — see
// `openhuman::flows::ops_tests` for the end-to-end
// `validate_tool_contracts` coverage of the same behavior.
-
-#[test]
-fn unsupported_arg_names_flags_a_name_not_in_properties() {
- let schema = json!({
- "type": "object",
- "properties": { "channel": {"type": "string"}, "markdown_text": {"type": "string"} }
- });
- let args = json!({ "channel": "#general", "text": "hi" });
- assert_eq!(
- unsupported_arg_names(Some(&schema), &args),
- Some(vec!["text".to_string()])
- );
-}
diff --git a/crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs b/crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs
index 58283704f8..8e984cc5d6 100644
--- a/crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/langfuse_export.rs
@@ -13,7 +13,7 @@
//! injector additionally stamps `flow_id` on every span for filtering.
//!
//! Transport mirrors the agent-turn tracing path
-//! (`agent::progress_tracing::langfuse::push_spans`): the endpoint is derived
+//! (`agent::progress_tracing::otlp::push_spans`): the endpoint is derived
//! from the **current backend hostname** (`effective_backend_api_url`), auth
//! is the live OpenHuman session bearer (the backend injects the real
//! Langfuse keys server-side), the send is capped at 10s, `207 Multi-Status`
diff --git a/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rs b/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rs
index 22a31017fa..819197c64e 100644
--- a/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/tinyflows_capabilities_tests.rs
@@ -306,18 +306,6 @@ fn parse_llm_json_rejects_prose_and_scalars() {
// ── tool_call required-arg preflight ─────────────────────────────────────
-#[test]
-fn missing_required_args_flags_absent_and_null() {
- let required = vec!["to".to_string(), "subject".to_string(), "body".to_string()];
- let args = json!({ "to": null, "subject": "hi" });
- assert_eq!(
- super::super::caps::missing_required_args(&required, &args),
- vec!["to".to_string(), "body".to_string()]
- );
- let full = json!({ "to": "[email protected]", "subject": "hi", "body": "text" });
- assert!(super::super::caps::missing_required_args(&required, &full).is_empty());
-}
-
#[tokio::test]
async fn preflight_fails_before_dispatch_naming_the_missing_field() {
let tmp = TempDir::new().unwrap();
diff --git a/crates/openhuman-core/src/json_schema/ops_tests.rs b/crates/openhuman-core/src/json_schema/ops_tests.rs
index 9a0195f423..704b81c37c 100644
--- a/crates/openhuman-core/src/json_schema/ops_tests.rs
+++ b/crates/openhuman-core/src/json_schema/ops_tests.rs
@@ -50,3 +50,92 @@ fn unsupported_arguments_follow_schema_openness() {
None
);
}
+
+#[test]
+fn unsupported_arg_names_empty_when_every_name_is_a_real_property() {
+ let schema = json!({
+ "type": "object",
+ "properties": { "channel": {"type": "string"}, "markdown_text": {"type": "string"} }
+ });
+ let args = json!({ "channel": "#general", "markdown_text": "hi" });
+ assert_eq!(unsupported_arg_names(Some(&schema), &args), Some(vec![]));
+}
+
+#[test]
+fn unsupported_arg_names_skips_when_schema_is_none() {
+ let args = json!({ "anything": "goes" });
+ assert_eq!(unsupported_arg_names(None, &args), None);
+}
+
+#[test]
+fn unsupported_arg_names_skips_when_schema_has_no_properties_object() {
+ // Legacy/loose schema shape (no `properties` map at all) — nothing to
+ // validate names against, so this must skip, not reject.
+ let schema = json!({ "type": "object", "description": "legacy shape" });
+ let args = json!({ "anything": "goes" });
+ assert_eq!(unsupported_arg_names(Some(&schema), &args), None);
+}
+
+#[test]
+fn unsupported_arg_names_empty_for_null_or_non_object_args() {
+ let schema = json!({
+ "type": "object",
+ "properties": { "channel": {"type": "string"} }
+ });
+ assert_eq!(
+ unsupported_arg_names(Some(&schema), &Value::Null),
+ Some(vec![])
+ );
+ assert_eq!(
+ unsupported_arg_names(Some(&schema), &json!("not an object")),
+ Some(vec![])
+ );
+}
+
+#[test]
+fn compute_primary_array_path_finds_a_top_level_array_property() {
+ let schema = json!({
+ "type": "object",
+ "properties": { "items": { "type": "array" }, "count": { "type": "integer" } }
+ });
+ assert_eq!(
+ compute_primary_array_path(Some(&schema)),
+ Some("items".to_string())
+ );
+}
+
+#[test]
+fn compute_primary_array_path_finds_a_nested_array_property() {
+ // Gmail-shaped: the array lives two levels down, under `data.messages`.
+ let schema = json!({
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "messages": { "type": "array" },
+ "nextPageToken": { "type": "string" }
+ }
+ }
+ }
+ });
+ assert_eq!(
+ compute_primary_array_path(Some(&schema)),
+ Some("data.messages".to_string())
+ );
+}
+
+#[test]
+fn compute_primary_array_path_none_when_absent_or_no_array_property() {
+ assert_eq!(compute_primary_array_path(None), None);
+ assert_eq!(
+ compute_primary_array_path(Some(&json!({ "type": "object" }))),
+ None
+ );
+ assert_eq!(
+ compute_primary_array_path(Some(
+ &json!({ "type": "object", "properties": { "id": { "type": "string" } } })
+ )),
+ None
+ );
+}