Skip to content

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

refactor(progress_tracing): flatten langfuse module layout

Steven Enamakel88a38049ecdd
diff --git a/crates/openhuman-core/src/agent/progress_tracing.rs b/crates/openhuman-core/src/agent/progress_tracing.rs
index e06c7ec766..ec4a515420 100644
--- a/crates/openhuman-core/src/agent/progress_tracing.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing.rs
@@ -54,6 +54,7 @@
/// Journal-backed projection from durable tinyagents observations.
pub(crate) mod journal_projection;
/// Langfuse ingestion exporter (remote push through the configured backend).
+#[path = "progress_tracing/langfuse/environment.rs"]
pub(crate) mod langfuse;
mod otlp;
diff --git a/crates/openhuman-core/src/agent/progress_tracing/README.md b/crates/openhuman-core/src/agent/progress_tracing/README.md
index 655bfc3c6a..9e99b7a759 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/README.md
+++ b/crates/openhuman-core/src/agent/progress_tracing/README.md
@@ -33,7 +33,7 @@ content).
`/telemetry/langfuse/otel/v1/traces` proxy; the backend supplies project
keys and authoritative user attribution. Export is on by default through
`observability.share_usage_data`; local NDJSON export remains optional.
-- [`langfuse.rs`](./langfuse.rs) + `langfuse/` hold the proxy URL and environment
+- [`langfuse/environment.rs`](./langfuse/environment.rs) hold the proxy URL and environment
resolution `otlp.rs` and the flow exporter share, plus the legacy batch
projection kept for compatibility tests. No trace is sent on the legacy
batch path; Langfuse v4 ingests traces only over OTLP.
diff --git a/crates/openhuman-core/src/agent/progress_tracing/langfuse.rs b/crates/openhuman-core/src/agent/progress_tracing/langfuse.rs
deleted file mode 100644
index 8338c423e5..0000000000
--- a/crates/openhuman-core/src/agent/progress_tracing/langfuse.rs
+++ /dev/null
@@ -1,46 +0,0 @@
-//! Langfuse proxy URL and environment resolution for agent trace export
-//! (issue #4249 follow-up).
-//!
-//! When `observability.share_usage_data` is enabled, a completed run's spans
-//! are POSTed as OTLP/HTTP JSON (see [`super::otlp`]) to the OpenHuman
-//! backend's Langfuse **proxy**, `/telemetry/langfuse/otel/v1/traces`, which
-//! sits beside the legacy `/telemetry/langfuse/ingestion` route
-//! [`ingestion_url`] resolves from the **current backend hostname**
-//! (`effective_backend_api_url`). The request reuses the OpenHuman **session
-//! bearer**; the backend authenticates that JWT, stamps the user on every span,
-//! injects the Langfuse project keys server-side, and forwards to Langfuse
-//! v4's `/api/public/otel/v1/traces` (backend `src/services/langfuseProxy.ts`).
-//! Clients never hold Langfuse keys. The legacy batch route is no longer used
-//! for traces: Langfuse Cloud removes it on 2026-11-16.
-//!
-//! Best-effort: any failure is logged and swallowed by the caller so tracing
-//! never breaks a turn. Spans always carry metadata (names, kinds, timings,
-//! and non-PII token/cost figures, promoted into Langfuse's native
-//! usage/cost details). Prompt/reply text and truncated tool I/O ride along
-//! only while `observability.agent_tracing.capture_content` is on; disabling
-//! that flag withholds content and leaves metadata-only export.
-
-mod environment;
-mod journal_export;
-
-pub(crate) use environment::{environment_for_base, ingestion_url, skip_push};
-pub(crate) use journal_export::journal_push_ready;
-
-#[cfg(test)]
-use crate::config::Config;
-#[cfg(test)]
-use environment::push_allowed;
-#[cfg(test)]
-use serde_json::json;
-#[cfg(test)]
-use tinyagents_harness::events::AgentEvent;
-#[cfg(test)]
-use tinyagents_harness::observability::trace_export::{SpanStatus, TraceSpan};
-#[cfg(test)]
-use tinyagents_harness::observability::AgentObservation;
-
-const LOG_TARGET: &str = "agent-tracing::langfuse";
-
-#[cfg(test)]
-#[path = "langfuse_tests.rs"]
-mod tests;
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..8fd8f9a2c1 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/langfuse/environment.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/langfuse/environment.rs
@@ -3,8 +3,9 @@
//! resolved host belongs to, and whether that environment may push at all.
use crate::config::Config;
+use crate::security::credentials::session_support::direct_backend_credential;
-use super::LOG_TARGET;
+const LOG_TARGET: &str = "agent-tracing::langfuse";
/// Backend proxy route for Langfuse ingestion (relative to the backend origin).
/// The backend authenticates the caller's session JWT, injects the Langfuse
@@ -149,3 +150,22 @@ pub(crate) fn skip_push(environment: &str) -> bool {
});
true
}
+
+/// Whether a journal push would actually send for `config`: the URL gate, the
+/// environment gate and a live session credential. Callers must read a journal
+/// and build observations first, so 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")
+ && matches!(
+ direct_backend_credential(config, "langfuse journal push"),
+ Some(crate::security::credentials::session_support::BackendCredential::Session(_))
+ )
+}
+
+#[cfg(test)]
+#[path = "../langfuse_tests.rs"]
+mod tests;
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
deleted file mode 100644
index 67e7b880f8..0000000000
--- a/crates/openhuman-core/src/agent/progress_tracing/langfuse/journal_export.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-//! Journal export readiness: whether a run's durable tinyagents observations
-//! would actually be sent to the backend's Langfuse proxy for a given config.
-
-use crate::config::Config;
-use crate::security::credentials::session_support::direct_backend_credential;
-
-use super::{environment_for_base, ingestion_url, skip_push};
-
-/// Whether a journal push would actually send for `config`: the URL gate, the
-/// environment gate and a live session credential. Callers must read a journal
-/// and build observations first, so 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")
- && matches!(
- direct_backend_credential(config, "langfuse journal push"),
- Some(crate::security::credentials::session_support::BackendCredential::Session(_))
- )
-}
diff --git a/crates/openhuman-core/src/agent/progress_tracing/langfuse_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/langfuse_tests.rs
index cdd4f4b90e..fdb287f841 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/langfuse_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/langfuse_tests.rs
@@ -1,5 +1,9 @@
use super::*;
+use serde_json::json;
use std::collections::BTreeMap;
+use tinyagents_harness::events::AgentEvent;
+use tinyagents_harness::observability::trace_export::{SpanStatus, TraceSpan};
+use tinyagents_harness::observability::AgentObservation;
use tinyagents_harness::ids::{EventId, RunId};
use tinyagents_harness::observability::trace_export::SpanKind;
diff --git a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_stop_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_stop_tests.rs
index 97c9cbc91f..927787ad67 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_stop_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_stop_tests.rs
@@ -57,7 +57,9 @@ fn a_breaker_stopped_turn_closes_at_warning_with_stop_attributes() {
(
AgentProgress::TurnCompleted {
iterations: 4,
- stop: Some(crate::agent::session_host::stop_summary::breaker_stop(BREAKER_NOTE)),
+ stop: Some(crate::agent::session_host::stop_summary::breaker_stop(
+ BREAKER_NOTE,
+ )),
},
50,
),
@@ -169,7 +171,9 @@ fn a_stopped_subagent_span_closes_at_warning_with_stop_attributes() {
(
subagent_completed(
"t-stop",
- Some(crate::agent::session_host::stop_summary::breaker_stop(BREAKER_NOTE)),
+ Some(crate::agent::session_host::stop_summary::breaker_stop(
+ BREAKER_NOTE,
+ )),
),
40,
),
diff --git a/crates/openhuman-core/src/agent_runs/workflow_runs/mod.rs b/crates/openhuman-core/src/agent_runs/workflow_runs/mod.rs
index cfc5eb9d82..563816194e 100644
--- a/crates/openhuman-core/src/agent_runs/workflow_runs/mod.rs
+++ b/crates/openhuman-core/src/agent_runs/workflow_runs/mod.rs
@@ -20,12 +20,22 @@
//! Namespace note: this is distinct from the existing `workflows` domain, which
//! handles SKILL.md / WORKFLOW.md bundle discovery.
-mod engine;
+#[path = "../../agent/orchestration/workflow_runs/host.rs"]
mod host;
+mod engine {
+ mod cancel {
+ include!("../../agent/orchestration/workflow_runs/engine/cancel.rs");
+ }
+ mod lifecycle {
+ include!("../../agent/orchestration/workflow_runs/engine/lifecycle.rs");
+ }
+ pub(super) const LOG_TARGET: &str = "workflow_run_engine";
+ pub use lifecycle::{resume_workflow_run, start_workflow_run, stop_workflow_run};
+}
mod ops;
mod schemas;
-pub use engine::{resume_workflow_run, start_workflow_run, stop_workflow_run};
+use engine::{resume_workflow_run, start_workflow_run, stop_workflow_run};
pub use ops::{
PARALLEL_RESEARCH_ID, builtin_definitions, definition_by_id, get_run, list_definitions,
list_runs,