Skip to content

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

chore: apply rustfmt formatting and split langfuse test modules

Steven Enamakel19a39320b023
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_adapter.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_adapter.rs
index 98a11c93e0..e315001d2b 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_adapter.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_adapter.rs
@@ -193,12 +193,14 @@ impl SubagentExecutor<crate::agent::tinyagents::host::OpenHumanRunContext> for O
parent_events,
name: definition.id.clone(),
};
- let run = Box::pin(crate::agent::subagent_host::ops::run_subagent_direct_with_native_context(
- &definition,
- &input,
- options.clone(),
- native,
- ));
+ let run = Box::pin(
+ crate::agent::subagent_host::ops::run_subagent_direct_with_native_context(
+ &definition,
+ &input,
+ options.clone(),
+ native,
+ ),
+ );
let result = match dispatch.into_core() {
Some(core) => {
crate::core::runtime::CoreContext::scope_with_turn_origin(core, origin, run)
diff --git a/crates/openhuman-core/src/agent/tinyagents/journal.rs b/crates/openhuman-core/src/agent/tinyagents/journal.rs
index 9393ea8f63..cba55c2945 100644
--- a/crates/openhuman-core/src/agent/tinyagents/journal.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/journal.rs
@@ -281,10 +281,9 @@ pub(crate) async fn read_run_tree_events(
use tinyagents_harness::observability::HarnessStatusStore as _;
let (journal_store, status_store) = journal_stores(ctx).await?;
- let statuses = status_store
- .list_by_root(root_run_id)
- .await
- .map_err(|e| anyhow::anyhow!("[journal] list_by_root failed root_run_id={root_run_id}: {e}"))?;
+ let statuses = status_store.list_by_root(root_run_id).await.map_err(|e| {
+ anyhow::anyhow!("[journal] list_by_root failed root_run_id={root_run_id}: {e}")
+ })?;
let mut run_ids = statuses
.into_iter()
.map(|status| status.run_id.as_str().to_owned())
@@ -298,10 +297,9 @@ pub(crate) async fn read_run_tree_events(
let journal = StoreEventJournal::new(journal_store);
let mut streams = Vec::with_capacity(run_ids.len());
for run_id in run_ids {
- let observations = journal
- .read_from(&run_id, 0)
- .await
- .map_err(|e| anyhow::anyhow!("[journal] read tree events failed run_id={run_id}: {e}"))?;
+ let observations = journal.read_from(&run_id, 0).await.map_err(|e| {
+ anyhow::anyhow!("[journal] read tree events failed run_id={run_id}: {e}")
+ })?;
if !observations.is_empty() {
streams.push(observations);
}
@@ -313,9 +311,7 @@ pub(crate) async fn read_run_tree_events(
/// Stable timestamp merge for independent run journals. Offsets are preserved
/// within every source stream; ties place child lifecycle/terminal facts before
/// parent acknowledgements and final run completion.
-pub(crate) fn merge_run_observations(
- streams: Vec<Vec<AgentObservation>>,
-) -> Vec<AgentObservation> {
+pub(crate) fn merge_run_observations(streams: Vec<Vec<AgentObservation>>) -> Vec<AgentObservation> {
let mut cursors = vec![0usize; streams.len()];
let mut merged = Vec::new();
loop {
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
index 624fb16b17..4f6fc983e3 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
@@ -383,13 +383,13 @@ async fn drive_turn(
// reconstructs the timeline from (05.1). The same id keys the journal + status.
let sink = EventSink::with_stream_id(journal_run_id.as_str());
if let Some(native) = &native_subagent {
- native.parent_events.emit(
- tinyagents_harness::events::AgentEvent::SubAgentRunStarted {
+ native
+ .parent_events
+ .emit(tinyagents_harness::events::AgentEvent::SubAgentRunStarted {
name: native.name.clone(),
depth: native.depth,
run_id: journal_run_id.clone(),
- },
- );
+ });
}
// Attach the event bridge for EVERY turn — including an unobserved
// (`on_progress = None`) background/cron turn (#4467, item 3). The bridge's
diff --git a/crates/openhuman-core/src/backend/telemetry/langfuse/environment.rs b/crates/openhuman-core/src/backend/telemetry/langfuse/environment.rs
index 7192a86f9f..1ffb5b3cab 100644
--- a/crates/openhuman-core/src/backend/telemetry/langfuse/environment.rs
+++ b/crates/openhuman-core/src/backend/telemetry/langfuse/environment.rs
@@ -167,5 +167,9 @@ pub(crate) fn journal_push_ready(config: &Config) -> bool {
}
#[cfg(test)]
-#[path = "../../../agent/progress_tracing/langfuse_tests.rs"]
+#[path = "environment_policy_tests.rs"]
mod tests;
+
+#[cfg(test)]
+#[path = "environment_parse_tests.rs"]
+mod parse_tests;
diff --git a/crates/openhuman-core/src/core/observability/progress_tracing/export.rs b/crates/openhuman-core/src/core/observability/progress_tracing/export.rs
index cca680e8fd..a271b56ec9 100644
--- a/crates/openhuman-core/src/core/observability/progress_tracing/export.rs
+++ b/crates/openhuman-core/src/core/observability/progress_tracing/export.rs
@@ -5,11 +5,11 @@ use crate::config::schema::AgentTracingConfig;
use crate::config::Config;
use crate::config::schema::AgentTracingBackend;
+use std::time::Duration;
+use tinyagents_harness::observability::trace_export::otlp::otlp_requests;
use tinyagents_harness::observability::trace_export::serialize::{spans_to_ndjson, SpanEnvelope};
use tinyagents_harness::observability::trace_export::{TraceContext, TraceSpan};
-use tinyagents_harness::observability::trace_export::otlp::otlp_requests;
use tinyagents_harness::observability::LangfuseClient;
-use std::time::Duration;
const PUSH_TIMEOUT: Duration = Duration::from_secs(10);
@@ -164,19 +164,15 @@ pub(crate) async fn export_run_trace_from_journal(
log::debug!("[agent-tracing] no durable root run registered request_id={request_id}");
return;
};
- let observations = match crate::agent::tinyagents::journal::read_run_tree_events(
- ctx,
- &root_run_id,
- )
- .await
- {
- Ok(observations) if !observations.is_empty() => observations,
- Ok(_) => return,
- Err(err) => {
- log::warn!("[agent-tracing] trace journal read failed run_id={root_run_id}: {err}");
- return;
- }
- };
+ let observations =
+ match crate::agent::tinyagents::journal::read_run_tree_events(ctx, &root_run_id).await {
+ Ok(observations) if !observations.is_empty() => observations,
+ Ok(_) => return,
+ Err(err) => {
+ log::warn!("[agent-tracing] trace journal read failed run_id={root_run_id}: {err}");
+ return;
+ }
+ };
let Some(root) = observations.iter().find(|observation| {
observation.run_id.as_str() == root_run_id && observation.parent_run_id.is_none()
}) else {
@@ -188,9 +184,8 @@ pub(crate) async fn export_run_trace_from_journal(
None,
Some(root.root_run_id.as_str().to_owned()),
);
- let mut collector = tinyagents_harness::observability::trace_export::collector::SpanCollector::new(
- trace_ctx,
- );
+ let mut collector =
+ tinyagents_harness::observability::trace_export::collector::SpanCollector::new(trace_ctx);
for observation in &observations {
collector.record(observation);
}