The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(agent): remove unused dispatch_subagent and push_observations functions
Steven Enamakel133e981d0ad4
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs b/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rsindex 9dece76525..51031d703a 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs@@ -146,28 +146,6 @@ pub(crate) enum DispatchMode {Blocking,}-pub(crate) async fn dispatch_subagent(- agent_id: &str,- tool_name: &str,- prompt: &str,- model_override: Option<&str>,- tool_context: Option<&dyn ToolRunContext>,- mode: DispatchMode,- run_context: crate::agent::tinyagents::host::OpenHumanRunContext,-) -> anyhow::Result<ToolResult> {- dispatch_subagent_with_live_parent(- agent_id,- tool_name,- prompt,- model_override,- tool_context,- mode,- run_context,- None,- )- .await-}-/// Dispatch one inline child against the caller's actual TinyAgents parent/// when the typed tool boundary has one. Standalone callers retain the/// explicit-carrier fallback above because no live parent exists for them.diff --git a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rsindex 57b476552b..f2a686c7a4 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/dispatch_tests.rs@@ -204,34 +204,6 @@ fn ask_clarification_tool_is_the_harness_tool() {assert_eq!(tool.name(), "ask_user_clarification");}-#[tokio::test]-async fn dispatch_subagent_returns_tool_error_when_agent_unknown() {- // Exercises the graceful-failure paths of `dispatch_subagent`:- // without a global registry we get the "registry not initialised"- // branch, and with one (set by another test in the same binary)- // a bogus agent id hits the "agent not found" branch. Either way- // the function must return `Ok(ToolResult::error(..))` rather than- // panicking or returning `Err`.- let res = dispatch_subagent(- "__definitely_not_a_real_agent__",- "test_tool",- "irrelevant prompt",- None,- None,- DispatchMode::Blocking,- crate::agent::tinyagents::host::OpenHumanRunContext::new(),- )- .await- .expect("dispatch_subagent should not return Err on these inputs");-- assert!(res.is_error, "expected a tool-error ToolResult");- let out = res.output();- assert!(- out.contains("registry not initialised") || out.contains("not found in registry"),- "unexpected graceful-failure message: {out}"- );-}-#[test]fn awaiting_user_outcome_maps_to_resume_envelope_not_bare_success() {// #4291: a delegated sub-agent that pauses on `ask_user_clarification`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.rsindex 30425e43df..f79a91ebe0 100644--- a/crates/openhuman-core/src/agent/progress_tracing/langfuse/journal_export.rs+++ b/crates/openhuman-core/src/agent/progress_tracing/langfuse/journal_export.rs@@ -53,80 +53,3 @@ pub(crate) fn journal_push_ready(config: &Config) -> bool {Some(crate::security::credentials::session_support::BackendCredential::Session(_)))}--pub(crate) async fn push_observations(- config: &Config,- trace_ctx: &TraceContext,- observations: &[AgentObservation],- run_telemetry: Option<&RunTelemetry>,-) -> Result<(), String> {- if observations.is_empty() {- return Ok(());- }- let url = ingestion_url(config);- // Same gate, same reasons as `push_spans` — both entry points are on the- // per-turn path, so both skip before doing any work.- let environment = environment_for_base(&url);- if skip_push(environment) {- return Ok(());- }- if !url.starts_with("http") {- return Err(format!(- "could not resolve Langfuse ingestion URL from backend host (got {url:?})"- ));- }- // No TinyHumans connection, or no usable credential (signed out, offline- // local session): a configured state, so skip quietly rather than failing- // every turn's push.- let token = match direct_backend_credential(config, "langfuse journal push") {- Some(crate::security::credentials::session_support::BackendCredential::Session(token)) => {- token- }- _ => return Ok(()),- };- // Stamp the run lineage from the run's own observations so a spawned- // sub-agent's trace links back to its parent turn (#4657).- let brand = crate::agent::progress_tracing::export_brand();- let trace_ctx = trace_ctx_with_run_lineage(trace_ctx, observations);- let trace = trace_config_from_context(&trace_ctx, environment, &brand);- let observation_count = observations.len();- let observations = observations_for_export(&trace_ctx, observations);-- tracing::debug!(- target: LOG_TARGET,- "[agent-tracing] pushing {observation_count} journal observations to Langfuse at {url}"- );-- let client = LangfuseClient::proxy(url, token)- .map_err(|err| format!("Langfuse client setup failed: {err}"))?;- let mut payload = client- .build_ingestion_batch(trace, observations.as_ref())- .map_err(|err| format!("Langfuse journal batch build failed: {err}"))?;- if insert_run_telemetry_generation(&mut payload, run_telemetry.map(run_totals).as_ref(), &brand)- {- tracing::debug!(- target: LOG_TARGET,- "[agent-tracing] added run telemetry aggregate to Langfuse journal batch"- );- } else {- tracing::debug!(- target: LOG_TARGET,- "[agent-tracing] no run telemetry aggregate added to Langfuse journal batch"- );- }- // Langfuse caps a single ingestion request at 500 events; a large run (e.g.- // one that spawns sub-agents) can far exceed that and previously had its- // ENTIRE trace rejected with a 400. Send in <=500-event chunks instead.- for chunk in split_ingestion_batch(payload, LANGFUSE_MAX_BATCH_EVENTS) {- tokio::time::timeout(PUSH_TIMEOUT, client.send_batch(chunk))- .await- .map_err(|_| format!("Langfuse journal push timed out after {PUSH_TIMEOUT:?}"))?- .map_err(|err| format!("Langfuse journal ingestion failed: {err}"))?;- }-- tracing::debug!(- target: LOG_TARGET,- "[agent-tracing] pushed {observation_count} journal observations to Langfuse"- );- Ok(())-}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.rsindex b66a73c1fc..7bcc9b2588 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@@ -36,62 +36,6 @@ fn every_environment_for_base_bucket_is_classified_deliberately() {)));}-#[tokio::test]-async fn api_key_credentials_are_not_used_for_langfuse_proxy_exports() {- let dir = tempfile::tempdir().unwrap();- let mut config = Config::default();- config.config_path = dir.path().join("config.toml");- config.workspace_dir = dir.path().join("workspace");- config.secrets.encrypt = false;- config.api_url = Some("http://127.0.0.1:9".to_string());- crate::security::credentials::api_key::store_api_key(&config, "th_live_test").unwrap();-- let ctx = TraceContext::new("trace:req-1", Some("user-1".to_string()));- let observations = vec![obs(- 1,- AgentEvent::ModelCompleted {- call_id: CallId::new("model-1"),- started_at_ms: Some(1_000),- usage: Some(Usage::new(10, 3)),- input: None,- output: None,- },- )];- assert!(!crate::agent::progress_tracing::langfuse::journal_export::journal_push_ready(&config));- assert_eq!(- crate::agent::progress_tracing::langfuse::journal_export::push_observations(- &config,- &ctx,- &observations,- None,- )- .await,- Ok(())- );-}--#[tokio::test]-async fn push_observations_skips_external_too() {- let mut config = Config::default();- config.api_url = Some("https://other.example".to_string());- let ctx = TraceContext::new("trace:req-1", Some("user-1".to_string()));- let observations = vec![obs(- 1,- AgentEvent::ModelCompleted {- call_id: CallId::new("model-1"),- started_at_ms: Some(1_000),- usage: Some(Usage::new(10, 3)),- input: None,- output: None,- },- )];-- assert_eq!(- push_observations(&config, &ctx, &observations, None).await,- Ok(())- );-}-#[test]fn ingestion_url_uses_backend_origin_and_ingestion_path() {let mut config = Config::default();