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): thread failure cause through subagent graph results
Steven Enamakel2c09f1199cb3
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_policy_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_policy_tests.rsindex 8951540571..fdbeb8d853 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_policy_tests.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_policy_tests.rs@@ -56,6 +56,7 @@ fn result_omits_worktree_fields_when_absent() {status: crate::agent::orchestration::spawn_parallel::ParallelAgentStatus::Completed,output: Some("ok".into()),error: None,+ failure_cause: None,awaiting_question: None,checkpoint_path: None,ownership: None,@@ -83,6 +84,7 @@ fn result_serializes_worktree_fields_when_present() {status: crate::agent::orchestration::spawn_parallel::ParallelAgentStatus::Completed,output: None,error: None,+ failure_cause: None,awaiting_question: None,checkpoint_path: None,ownership: None,diff --git a/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rs b/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rsindex 50b6f218f6..4124c84cbc 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rs@@ -558,10 +558,7 @@ pub(crate) async fn dispatch_subagent_with_live_parent(worktree_path: None,changed_files: Vec::new(),dirty_status: None,- stop: incomplete_stop(- reason,- outcome.failure_cause.clone(),- ),+ stop: incomplete_stop(reason, outcome.failure_cause.clone()),}).await;}diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rsindex eed019ed3d..4ac9b6c371 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph_tests.rs@@ -306,39 +306,40 @@ async fn subagent_runs_through_the_graph_engine_with_real_tools() {allowed.insert("echo".to_string());let mut history = vec![TranscriptMessage::user("please echo hi")];- let (output, iterations, usage, early_exit, hit_cap, _breaker) = run_subagent_via_graph(- crate::agent::tinyagents::TurnModelSource::from_model(provider),- "mock-model",- 0.0,- &mut history,- parent_tools,- vec![],- vec![],- allowed,- 10,- (None, None),- None,- "researcher",- "task-1",- false,- None,- crate::agent::tinyagents::host::OpenHumanRunContext::new(),- None,- std::env::temp_dir(),- None,- 1024,- false,- "root-session__real_tools",- "mock-channel",- AgentTokenjuiceCompression::Off,- // No host config in tests: the graph takes byte-cap-only- // context defaults instead of reading the developer machine's- // real config.toml, which is what the old in-graph load did.- None,- None,- )- .await- .expect("graph subagent runs");+ let (output, iterations, usage, early_exit, hit_cap, _breaker, _cause) =+ run_subagent_via_graph(+ crate::agent::tinyagents::TurnModelSource::from_model(provider),+ "mock-model",+ 0.0,+ &mut history,+ parent_tools,+ vec![],+ vec![],+ allowed,+ 10,+ (None, None),+ None,+ "researcher",+ "task-1",+ false,+ None,+ crate::agent::tinyagents::host::OpenHumanRunContext::new(),+ None,+ std::env::temp_dir(),+ None,+ 1024,+ false,+ "root-session__real_tools",+ "mock-channel",+ AgentTokenjuiceCompression::Off,+ // No host config in tests: the graph takes byte-cap-only+ // context defaults instead of reading the developer machine's+ // real config.toml, which is what the old in-graph load did.+ None,+ None,+ )+ .await+ .expect("graph subagent runs");assert_eq!(output, "all done");assert_eq!(iterations, 2);@@ -393,7 +394,7 @@ async fn child_text_and_thinking_deltas_are_scoped_to_the_subagent() {let parent_tools: Arc<Vec<Box<dyn Tool>>> = Arc::new(vec![]);let mut history = vec![TranscriptMessage::user("hi")];- let (output, _iters, _usage, _early, _hit_cap, _breaker) = run_subagent_via_graph(+ let (output, _iters, _usage, _early, _hit_cap, _breaker, _cause) = run_subagent_via_graph(crate::agent::tinyagents::TurnModelSource::from_model(Arc::new(ThinkingStreamProvider)),"mock-model",0.0,@@ -530,39 +531,40 @@ async fn ask_user_clarification_pauses_and_surfaces_the_question() {allowed.insert("ask_user_clarification".to_string());let mut history = vec![TranscriptMessage::user("help me")];- let (output, iterations, _usage, early_exit, _hit_cap, _breaker) = run_subagent_via_graph(- crate::agent::tinyagents::TurnModelSource::from_model(provider.clone()),- "mock-model",- 0.0,- &mut history,- parent_tools,- vec![],- vec![],- allowed,- 10,- (None, None),- None,- "researcher",- "task-9",- false,- None,- crate::agent::tinyagents::host::OpenHumanRunContext::new(),- None,- std::env::temp_dir(),- None,- 1024,- false,- "root-session__clarification",- "mock-channel",- AgentTokenjuiceCompression::Off,- // No host config in tests: the graph takes byte-cap-only- // context defaults instead of reading the developer machine's- // real config.toml, which is what the old in-graph load did.- None,- None,- )- .await- .expect("ask-clarification subagent runs");+ let (output, iterations, _usage, early_exit, _hit_cap, _breaker, _cause) =+ run_subagent_via_graph(+ crate::agent::tinyagents::TurnModelSource::from_model(provider.clone()),+ "mock-model",+ 0.0,+ &mut history,+ parent_tools,+ vec![],+ vec![],+ allowed,+ 10,+ (None, None),+ None,+ "researcher",+ "task-9",+ false,+ None,+ crate::agent::tinyagents::host::OpenHumanRunContext::new(),+ None,+ std::env::temp_dir(),+ None,+ 1024,+ false,+ "root-session__clarification",+ "mock-channel",+ AgentTokenjuiceCompression::Off,+ // No host config in tests: the graph takes byte-cap-only+ // context defaults instead of reading the developer machine's+ // real config.toml, which is what the old in-graph load did.+ None,+ None,+ )+ .await+ .expect("ask-clarification subagent runs");// The loop paused after the tool round: the early-exit tool is surfaced// and the question is the returned text — the second model turn never ran.@@ -623,39 +625,40 @@ async fn cap_hit_summarizes_a_resumable_checkpoint() {allowed.insert("noop".to_string());let mut history = vec![TranscriptMessage::user("do a big task")];- let (output, iterations, _usage, early_exit, hit_cap, _breaker) = run_subagent_via_graph(- crate::agent::tinyagents::TurnModelSource::from_model(Arc::new(LoopForeverProvider)),- "mock-model",- 0.0,- &mut history,- parent_tools,- vec![],- vec![],- allowed,- 2,- (None, None),- None,- "researcher",- "task-cap",- false,- None,- crate::agent::tinyagents::host::OpenHumanRunContext::new(),- None,- std::env::temp_dir(),- None,- 1024,- false,- "root-session__cap_hit",- "mock-channel",- AgentTokenjuiceCompression::Off,- // No host config in tests: the graph takes byte-cap-only- // context defaults instead of reading the developer machine's- // real config.toml, which is what the old in-graph load did.- None,- None,- )- .await- .expect("cap-hit subagent runs");+ let (output, iterations, _usage, early_exit, hit_cap, _breaker, _cause) =+ run_subagent_via_graph(+ crate::agent::tinyagents::TurnModelSource::from_model(Arc::new(LoopForeverProvider)),+ "mock-model",+ 0.0,+ &mut history,+ parent_tools,+ vec![],+ vec![],+ allowed,+ 2,+ (None, None),+ None,+ "researcher",+ "task-cap",+ false,+ None,+ crate::agent::tinyagents::host::OpenHumanRunContext::new(),+ None,+ std::env::temp_dir(),+ None,+ 1024,+ false,+ "root-session__cap_hit",+ "mock-channel",+ AgentTokenjuiceCompression::Off,+ // No host config in tests: the graph takes byte-cap-only+ // context defaults instead of reading the developer machine's+ // real config.toml, which is what the old in-graph load did.+ None,+ None,+ )+ .await+ .expect("cap-hit subagent runs");// The loop paused at the 2-call budget and summarized instead of erroring.assert!(early_exit.is_none());diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rsindex 5ea0d58ab4..e0a8783522 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs@@ -792,15 +792,7 @@ async fn run_typed_mode();}- let (- output,- iterations,- agg_usage,- early_exit_tool,- hit_cap,- breaker_halt,- failure_cause,- ) =+ let (output, iterations, agg_usage, early_exit_tool, hit_cap, breaker_halt, failure_cause) =super::graph::run_subagent_via_graph(subagent_source.clone(),&model,diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rsindex 4253ce16b2..44d3d50e2f 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs@@ -394,10 +394,7 @@ impl FailureScopePolicy<OpenHumanRunContext> for HostFailurePolicy {repeat_guard_marker(result).is_some()}- fn record_guard_refusal(- &self,- _ctx: &RunContext<OpenHumanRunContext>,- ) {+ fn record_guard_refusal(&self, _ctx: &RunContext<OpenHumanRunContext>) {self.stop.record_refusal();}diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rsindex 8f73b54d38..a58605c711 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs@@ -375,21 +375,15 @@ impl ToolCallPolicy<OpenHumanRunContext> for SessionCeilingPolicy {) -> PolicyDecision {#[cfg(feature = "modules")]let approvals_disabled = if let Some(tool) = self.host.resolve_tool(&call.name) {- crate::desktop::control::approvals_disabled_for(- &ctx.data.dispatch_ctx(),- tool.as_ref(),- )- .await+ crate::desktop::control::approvals_disabled_for(&ctx.data.dispatch_ctx(), tool.as_ref())+ .await} else {false};#[cfg(not(feature = "modules"))]let approvals_disabled = false;- match self- .host- .channel_permission_block(call, approvals_disabled)- {+ match self.host.channel_permission_block(call, approvals_disabled) {Some(reason) => PolicyDecision::deny(reason),None => PolicyDecision::Allow,}