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/context.rs,crates/openhuman-core/src/cor
Steven Enamakelc76c83d5b505
diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rsindex 982a562a15..3a614d828b 100644--- a/crates/openhuman-core/src/core/runtime/context.rs+++ b/crates/openhuman-core/src/core/runtime/context.rs@@ -88,6 +88,8 @@ pub struct CoreContext {/// Whether autonomy-tier checks reload config or retain this context's/// effective in-memory tier.autonomy_tier_source: super::AutonomyTierSource,+ /// A fixed maximum autonomy level inherited by derived contexts.+ autonomy_tier_ceiling: Option<crate::security::AutonomyLevel>,/// Which tiny dependencies the config switched off (`[components]`). Only/// narrows: `domains` and `tool_groups` are already clamped by it, and this/// is kept so dispatch can answer `COMPONENT_DISABLED:<name>` for a method@@ -290,6 +292,7 @@ impl CoreContext {domains,tool_groups,autonomy_tier_source: super::AutonomyTierSource::LiveConfig,+ autonomy_tier_ceiling: None,components,embedder_config,user_skill_roots: true,@@ -422,7 +425,13 @@ impl CoreContext {workspace_binding: RwLock::new(shared_binding),domains,tool_groups: overlay.tool_groups,- autonomy_tier_source: overlay.autonomy_tier_source,+ autonomy_tier_source: overlay+ .autonomy_tier_source+ .unwrap_or(self.autonomy_tier_source),+ autonomy_tier_ceiling: stricter_autonomy_ceiling(+ self.autonomy_tier_ceiling,+ overlay.autonomy_tier_ceiling,+ ),components: self.components,embedder_config: Some(overlay.config),user_skill_roots: overlay.user_skill_roots,@@ -447,6 +456,11 @@ impl CoreContext {self.autonomy_tier_source}+ /// The fixed autonomy ceiling inherited by this context, if any.+ pub fn autonomy_tier_ceiling(&self) -> Option<crate::security::AutonomyLevel> {+ self.autonomy_tier_ceiling+ }+/// The backend transport bound to this context, if the host supplied one.pub fn backend_transport(&self,@@ -589,6 +603,20 @@ impl CoreContext {}}+fn stricter_autonomy_ceiling(+ left: Option<crate::security::AutonomyLevel>,+ right: Option<crate::security::AutonomyLevel>,+) -> Option<crate::security::AutonomyLevel> {+ use crate::security::AutonomyLevel::{Full, ReadOnly, Supervised};++ match (left, right) {+ (None, ceiling) | (ceiling, None) => ceiling,+ (Some(ReadOnly), _) | (_, Some(ReadOnly)) => Some(ReadOnly),+ (Some(Supervised), _) | (_, Some(Supervised)) => Some(Supervised),+ (Some(Full), Some(Full)) => Some(Full),+ }+}+/// Initialize the workspace-bound stores and report the memory engine.////// A `Config::load_or_init` failure here is operator-visible and seriousdiff --git a/crates/openhuman-core/src/core/runtime/context_overlay.rs b/crates/openhuman-core/src/core/runtime/context_overlay.rsindex e1d36f6302..dbac553b42 100644--- a/crates/openhuman-core/src/core/runtime/context_overlay.rs+++ b/crates/openhuman-core/src/core/runtime/context_overlay.rs@@ -11,8 +11,6 @@ pub enum AutonomyTierSource {LiveConfig,/// Keep the effective tier supplied by an in-memory agent configuration.Captured,- /// Keep the host-only read-only restriction even if config changes.- ReadOnlyCeiling,}/// Per-agent overrides layered onto a booted context by@@ -55,7 +53,9 @@ pub struct ContextOverlay {/// action budget. `None` keeps the parent's.pub agent_policy: Option<Arc<crate::security::SecurityPolicy>>,/// Source binding for autonomy-tier gates under this context.- pub autonomy_tier_source: AutonomyTierSource,+ pub autonomy_tier_source: Option<AutonomyTierSource>,+ /// A fixed maximum autonomy level inherited by derived contexts.+ pub autonomy_tier_ceiling: Option<crate::security::AutonomyLevel>,/// Turn the interactive approval gate off for this agent.pub approvals_disabled: bool,/// The agent's own sub-agent catalogue. `None` keeps the parent's.@@ -78,7 +78,8 @@ impl ContextOverlay {session_agent: None,profile: None,agent_policy: None,- autonomy_tier_source: AutonomyTierSource::LiveConfig,+ autonomy_tier_source: None,+ autonomy_tier_ceiling: None,approvals_disabled: false,definitions: None,}@@ -120,13 +121,13 @@ impl ContextOverlay {/// Keep autonomy tier bound to this context's effective in-memory config.pub fn captured_autonomy_tier(mut self) -> Self {- self.autonomy_tier_source = AutonomyTierSource::Captured;+ self.autonomy_tier_source = Some(AutonomyTierSource::Captured);self}/// Keep this context's effective autonomy tier at ReadOnly.pub fn read_only_autonomy_ceiling(mut self) -> Self {- self.autonomy_tier_source = AutonomyTierSource::ReadOnlyCeiling;+ self.autonomy_tier_ceiling = Some(crate::security::AutonomyLevel::ReadOnly);self}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 2b1ab3b393..8b0b10cd4f 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@@ -64,6 +64,54 @@ fn code_node_tier_gate_blocks_readonly_allows_full() {);}+/// A long-lived code capability must observe a tier downgrade at the same+/// config path before it reaches code staging or sandbox execution.+#[tokio::test]+async fn code_adapter_observes_file_backed_tier_changes_between_calls() {+ use crate::config::AutonomyConfig;+ use crate::security::{AutonomyLevel, SecurityPolicy};++ 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");+ 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();+ config.autonomy = AutonomyConfig {+ enabled: true,+ level: AutonomyLevel::Full,+ ..AutonomyConfig::default()+ };+ config.save().await.unwrap();++ let code = OpenHumanCode {+ ctx: crate::core::runtime::DispatchCtx::ambient(),+ security: Arc::new(SecurityPolicy::from_config(+ &config.autonomy,+ &config.workspace_dir,+ &config.action_dir,+ )),+ config: Arc::new(config.clone()),+ approval: Default::default(),+ };++ // Simulate Settings changing the same persisted config after the run has+ // already captured Full. No global policy hooks or timing are involved.+ let mut changed = config;+ changed.autonomy.level = AutonomyLevel::ReadOnly;+ changed.save().await.unwrap();++ let err = code+ .run(tinyflows::caps::CodeLanguage::JavaScript, "return 1;", json!([]))+ .await+ .expect_err("the next call must observe the persisted ReadOnly tier");+ assert!(+ matches!(err, EngineError::Capability(ref message) if message.contains(POLICY_BLOCKED_MARKER)),+ "tier downgrade must block before staging or execution; got {err:?}"+ );+}+/// 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).