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
chore: files changed crates/openhuman-core/src/core/runtime/agent_scope_tests.rs,crates/openhuman-co
Steven Enamakel40fcc7aac34e
diff --git a/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs b/crates/openhuman-core/src/core/runtime/agent_scope_tests.rsindex 6ab6a04835..63b3b683d2 100644--- a/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs+++ b/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs@@ -54,10 +54,7 @@ fn autonomy_tier_source_and_ceiling_survive_derived_contexts() {child.autonomy_tier_source(),crate::core::runtime::AutonomyTierSource::Captured);- assert_eq!(- child.autonomy_tier_ceiling(),- Some(AutonomyLevel::ReadOnly)- );+ assert_eq!(child.autonomy_tier_ceiling(), Some(AutonomyLevel::ReadOnly));let mut source_override = overlay("/tmp/autonomy-source-override");source_override.autonomy_tier_source =diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/http.rs b/crates/openhuman-core/src/flows/tinyflows/caps/http.rsindex 8d5eb86493..8087cc9a1a 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/http.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/http.rs@@ -179,7 +179,8 @@ impl HttpClient for OpenHumanHttp {// `gate_call_for_tier` is what actually performs the `Prompt` round-trip// — it escalates a Supervised `Prompt` decision into a forced approval// regardless of the flow's own `require_approval` toggle (Codex P1).- let security = Arc::new(current_tier_policy(&self.ctx, &self.config, &self.security).await?);+ let security =+ Arc::new(current_tier_policy(&self.ctx, &self.config, &self.security).await?);let tier_decision =enforce_node_tier_gate(&security, CommandClass::Network, "http_request")?;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.rsindex bbd2a8d654..cf8c332267 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@@ -44,11 +44,8 @@ async fn one_live_capability_observes_full_readonly_full_updates() {let mut config = persisted_tier_config(dir.path(), true, AutonomyLevel::Full);save_tier_config(&config).await;let ctx = live_tier_context(&config);- let mut baseline = SecurityPolicy::from_config(- &config.autonomy,- &config.workspace_dir,- &config.action_dir,- );+ let mut baseline =+ SecurityPolicy::from_config(&config.autonomy, &config.workspace_dir, &config.action_dir);baseline.trusted_roots.push(crate::security::TrustedRoot {path: dir.path().join("trusted").display().to_string(),access: crate::security::TrustedAccess::ReadWrite,@@ -68,15 +65,11 @@ async fn one_live_capability_observes_full_readonly_full_updates() {);config.autonomy.level = AutonomyLevel::ReadOnly;save_tier_config(&config).await;- assert!(enforce_current_node_tier_gate(- &ctx,- &config,- &baseline,- CommandClass::Write,- "code"- )- .await- .is_err());+ assert!(+ enforce_current_node_tier_gate(&ctx, &config, &baseline, CommandClass::Write, "code")+ .await+ .is_err()+ );config.autonomy.level = AutonomyLevel::Full;save_tier_config(&config).await;@@ -97,20 +90,12 @@ async fn live_tier_reload_failure_fails_closed() {let config = persisted_tier_config(dir.path(), true, AutonomyLevel::Full);std::fs::create_dir_all(&config.config_path).unwrap();let ctx = live_tier_context(&config);- let baseline = SecurityPolicy::from_config(- &config.autonomy,- &config.workspace_dir,- &config.action_dir,- );- let error = enforce_current_node_tier_gate(- &ctx,- &config,- &baseline,- CommandClass::Write,- "code",- )- .await- .expect_err("a directory at config_path must not fall back to captured Full");+ let baseline =+ SecurityPolicy::from_config(&config.autonomy, &config.workspace_dir, &config.action_dir);+ let error =+ enforce_current_node_tier_gate(&ctx, &config, &baseline, CommandClass::Write, "code")+ .await+ .expect_err("a directory at config_path must not fall back to captured Full");assert!(matches!(error,EngineError::Capability(ref message) if message.contains(POLICY_BLOCKED_MARKER)@@ -130,20 +115,12 @@ async fn malformed_live_config_is_denied_without_echoing_its_contents() {).unwrap();let ctx = live_tier_context(&config);- let baseline = SecurityPolicy::from_config(- &config.autonomy,- &config.workspace_dir,- &config.action_dir,- );- let error = enforce_current_node_tier_gate(- &ctx,- &config,- &baseline,- CommandClass::Write,- "code",- )- .await- .expect_err("malformed persisted policy must deny rather than reuse Full");+ let baseline =+ SecurityPolicy::from_config(&config.autonomy, &config.workspace_dir, &config.action_dir);+ let error =+ enforce_current_node_tier_gate(&ctx, &config, &baseline, CommandClass::Write, "code")+ .await+ .expect_err("malformed persisted policy must deny rather than reuse Full");let message = match error {EngineError::Capability(message) => message,other => panic!("expected capability denial, got {other:?}"),@@ -174,9 +151,7 @@ async fn captured_agent_and_config_fn_tiers_are_not_replaced_by_parent_file() {);captured_overlay.autonomy_tier_source =Some(crate::core::runtime::AutonomyTierSource::Captured);- let captured_ctx = crate::core::runtime::DispatchCtx::new(- parent.derive_with(captured_overlay),- );+ let captured_ctx = crate::core::runtime::DispatchCtx::new(parent.derive_with(captured_overlay));let captured_policy = SecurityPolicy::from_config(&captured.autonomy,&captured.workspace_dir,@@ -208,8 +183,8 @@ async fn captured_agent_and_config_fn_tiers_are_not_replaced_by_parent_file() {&captured.workspace_dir,&captured.action_dir,);- let effective = tier_policy_from_config(&capped_ctx, &captured, Some(&parent_file), &baseline)- .unwrap();+ let effective =+ tier_policy_from_config(&capped_ctx, &captured, Some(&parent_file), &baseline).unwrap();assert_eq!(effective.autonomy, AutonomyLevel::Supervised);assert_eq!(effective.gate_decision(CommandClass::Write),@@ -219,13 +194,9 @@ async fn captured_agent_and_config_fn_tiers_are_not_replaced_by_parent_file() {capped_overlay.autonomy_tier_ceiling = Some(AutonomyLevel::Full);let full_ceiling_ctx =crate::core::runtime::DispatchCtx::new(parent.derive_with(capped_overlay));- let disabled_full_ceiling = tier_policy_from_config(- &full_ceiling_ctx,- &captured,- Some(&parent_file),- &baseline,- )- .unwrap();+ let disabled_full_ceiling =+ tier_policy_from_config(&full_ceiling_ctx, &captured, Some(&parent_file), &baseline)+ .unwrap();assert!(!disabled_full_ceiling.enabled);assert_eq!(disabled_full_ceiling.autonomy, AutonomyLevel::Full);assert_eq!(@@ -243,13 +214,8 @@ async fn captured_agent_and_config_fn_tiers_are_not_replaced_by_parent_file() {host_only_overlay.autonomy_tier_ceiling = Some(AutonomyLevel::ReadOnly);let host_only_ctx =crate::core::runtime::DispatchCtx::new(parent.derive_with(host_only_overlay));- let host_only = tier_policy_from_config(- &host_only_ctx,- &captured,- Some(&parent_file),- &baseline,- )- .unwrap();+ let host_only =+ tier_policy_from_config(&host_only_ctx, &captured, Some(&parent_file), &baseline).unwrap();assert_eq!(host_only.autonomy, AutonomyLevel::ReadOnly);assert_eq!(host_only.gate_decision(CommandClass::Write),@@ -331,7 +297,11 @@ async fn code_adapter_observes_file_backed_tier_changes_between_calls() {config.workspace_dir = dir.path().join("workspace");std::fs::create_dir_all(&config.workspace_dir).unwrap();config.action_dir = dir.path().join("action-is-a-file");- std::fs::write(&config.action_dir, "blocks code staging after the tier gate").unwrap();+ std::fs::write(+ &config.action_dir,+ "blocks code staging after the tier gate",+ )+ .unwrap();config.autonomy = AutonomyConfig {enabled: true,level: AutonomyLevel::Full,@@ -366,7 +336,11 @@ async fn code_adapter_observes_file_backed_tier_changes_between_calls() {changed.save().await.unwrap();let err = code- .run(tinyflows::caps::CodeLanguage::JavaScript, "return 1;", json!([]))+ .run(+ tinyflows::caps::CodeLanguage::JavaScript,+ "return 1;",+ json!([]),+ ).await.expect_err("the next call must observe the persisted ReadOnly tier");assert!(@@ -375,6 +349,84 @@ async fn code_adapter_observes_file_backed_tier_changes_between_calls() {);}+#[tokio::test]+async fn native_adapter_uses_live_upgrade_for_filesystem_write() {+ use crate::security::{AutonomyLevel, SecurityPolicy};++ let dir = tempfile::tempdir().unwrap();+ let mut captured = persisted_tier_config(dir.path(), true, AutonomyLevel::ReadOnly);+ save_tier_config(&captured).await;+ let mut live = captured.clone();+ live.autonomy.level = AutonomyLevel::Full;+ save_tier_config(&live).await;++ let tools = OpenHumanTools {+ ctx: live_tier_context(&captured),+ config: Arc::new(captured.clone()),+ security: Arc::new(SecurityPolicy::from_config(+ &captured.autonomy,+ &captured.workspace_dir,+ &captured.action_dir,+ )),+ approval: Default::default(),+ };+ tools+ .invoke(+ "oh:file_write",+ json!({ "path": "tier-upgrade.txt", "content": "written" }),+ None,+ )+ .await+ .expect("live Full tier and downstream filesystem gate must allow the write");+ assert_eq!(+ std::fs::read_to_string(captured.action_dir.join("tier-upgrade.txt")).unwrap(),+ "written"+ );+}++#[tokio::test]+async fn http_adapter_passes_its_live_upgrade_to_the_http_gate_without_egress() {+ use crate::security::{AutonomyLevel, SecurityPolicy};++ let dir = tempfile::tempdir().unwrap();+ let captured = persisted_tier_config(dir.path(), true, AutonomyLevel::ReadOnly);+ save_tier_config(&captured).await;+ let mut live = captured.clone();+ live.autonomy.level = AutonomyLevel::Full;+ save_tier_config(&live).await;+ let http = OpenHumanHttp {+ ctx: live_tier_context(&captured),+ config: Arc::new(captured.clone()),+ security: Arc::new(SecurityPolicy::from_config(+ &captured.autonomy,+ &captured.workspace_dir,+ &captured.action_dir,+ )),+ http_config: HttpRequestConfig {+ allowed_domains: vec!["example.com".to_string()],+ ..Default::default()+ },+ http_creds: Arc::new(HttpCredentialsStore::from_config(&captured)),+ approval: Default::default(),+ };++ // The URL is syntactically invalid, so the inner HTTP tool rejects it+ // before DNS or network access. Reaching that validation proves its+ // NetGate received the same live Full policy as the outer tier decision.+ let error = http+ .request(json!({ "method": "GET", "url": "not-a-url" }), None)+ .await+ .expect_err("invalid URL must fail before network access");+ let message = match error {+ EngineError::Capability(message) => message,+ other => panic!("expected capability error, got {other:?}"),+ };+ assert!(+ !message.contains("autonomy is read-only"),+ "downstream NetGate used the stale ReadOnly policy: {message}"+ );+}+/// End-to-end at the adapter: an `http_request` node under a read-only tier/// is refused BEFORE any network egress (the tier gate fires ahead of the/// approval gate, credential resolution, and dispatch).diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/tier.rs b/crates/openhuman-core/src/flows/tinyflows/caps/tier.rsindex 3059c57de0..fc34ce006c 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/tier.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/tier.rs@@ -85,7 +85,9 @@ pub(crate) async fn current_tier_policy(.await.map_err(|error| tier_config_error(&error))?;if live.recovered_from_corruption {- return Err(tier_config_error("live config was recovered from corruption"));+ return Err(tier_config_error(+ "live config was recovered from corruption",+ ));}Some(live)}@@ -115,16 +117,18 @@ pub(crate) fn tier_policy_from_config(return Ok(policy);}- let config = live_config- .ok_or_else(|| tier_config_error("live config snapshot was not provided"))?;+ let config =+ live_config.ok_or_else(|| tier_config_error("live config snapshot was not provided"))?;if config.autonomy.enabled {policy.enabled = true;policy.autonomy = config.autonomy.level;if let Some(ceiling) = ceiling {policy.autonomy = stricter_tier(policy.autonomy, ceiling);}- } else if let Some(ceiling @ (crate::security::AutonomyLevel::ReadOnly- | crate::security::AutonomyLevel::Supervised)) = ceiling+ } else if let Some(+ ceiling @ (crate::security::AutonomyLevel::ReadOnly+ | crate::security::AutonomyLevel::Supervised),+ ) = ceiling{// A disabled config contributes no tier restriction; a restrictive// host ceiling remains independently active.diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs b/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rsindex 77e943669b..c08509d48d 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/tools/composio.rs@@ -127,11 +127,8 @@ impl ToolBackend for ComposioToolBackend {Some(&live_config),ctx.security,)?;- let tier_decision = super::super::enforce_node_tier_gate(- &tier_policy,- composio_class,- "tool_call",- )?;+ let tier_decision =+ super::super::enforce_node_tier_gate(&tier_policy, composio_class, "tool_call")?;tracing::debug!(target: "flows",%slug,diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rs b/crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rsindex d2bfedead9..2f607c0c53 100644--- a/crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rs+++ b/crates/openhuman-core/src/flows/tinyflows/caps/tools/native.rs@@ -53,11 +53,7 @@ impl ToolBackend for NativeToolBackend {&args,).map_err(EngineError::Capability)?;- let tier_decision = super::super::enforce_node_tier_gate(- &security,- class,- "tool_call",- )?;+ let tier_decision = super::super::enforce_node_tier_gate(&security, class, "tool_call")?;let summary = crate::security::approval::summarize_action(tool_name, &args);let redacted = crate::security::approval::redact_args(&args);let (outcome, audit_id) = super::super::gate_call_for_tier(@@ -79,20 +75,15 @@ impl ToolBackend for NativeToolBackend {?tier_decision,"[flows] tool_call: dispatching NATIVE OpenHuman tool");- let exec_result =- crate::tools::native_ops::execute_tool_with_security(- ctx.config,- security,- tool_name,- args,- false,- )- .await- .map_err(EngineError::Capability)- .and_then(|outcome| {- super::super::reject_failed_native_tool_result(slug, &outcome.result)- .map(|_| super::super::native_tool_payload(&outcome.result))- });+ let exec_result = crate::tools::native_ops::execute_tool_with_security(+ ctx.config, security, tool_name, args, false,+ )+ .await+ .map_err(EngineError::Capability)+ .and_then(|outcome| {+ super::super::reject_failed_native_tool_result(slug, &outcome.result)+ .map(|_| super::super::native_tool_payload(&outcome.result))+ });// E-m1: close out the approval audit row (unlike the http/code/// Composio paths, this used to discard the request id and never