Skip to content

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

fix(harness): enable autonomy policy for restrictive access tiers

Steven Enamakel6cf5b5d71b53
diff --git a/crates/openhuman-embed/src/harness/access.rs b/crates/openhuman-embed/src/harness/access.rs
index e6136000ac..5141b68b11 100644
--- a/crates/openhuman-embed/src/harness/access.rs
+++ b/crates/openhuman-embed/src/harness/access.rs
@@ -154,6 +154,14 @@ impl Access {
/// scoped-down agent.
pub(crate) fn apply(&self, config: &mut openhuman_core::config::Config) {
config.autonomy.level = self.level;
+ // The tier only binds while the policy is on, and the core ships it
+ // off (`[autonomy] enabled = false`). Without this, `readonly()` and
+ // `supervised()` would leave shell and file writes wide open. `full()`
+ // keeps whatever the base config says, so existing automation hosts
+ // see no change.
+ if self.level != AutonomyLevel::Full {
+ config.autonomy.enabled = true;
+ }
config.autonomy.allow_tool_install = self.allow_tool_install;
config.autonomy.trusted_roots = self.trusted_roots.clone();
// `auto_approve_all` is deliberately NOT set for `full()`. The origin
diff --git a/crates/openhuman-embed/src/harness/access_tests.rs b/crates/openhuman-embed/src/harness/access_tests.rs
index 79c19fbdfa..a8ed8cdeb4 100644
--- a/crates/openhuman-embed/src/harness/access_tests.rs
+++ b/crates/openhuman-embed/src/harness/access_tests.rs
@@ -140,3 +140,27 @@ fn an_explicit_origin_overrides_the_preset() {
})
));
}
+
+/// The core ships the policy off, which makes every tier inert. A scoped-down
+/// access level must switch it on, or `readonly()` would still let the agent
+/// write files and run commands.
+#[test]
+fn restrictive_tiers_switch_the_policy_on() {
+ for access in [Access::readonly(), Access::supervised()] {
+ let mut config = openhuman_core::config::Config::default();
+ config.autonomy.enabled = false;
+ access.apply(&mut config);
+ assert!(config.autonomy.enabled, "{access:?} must enable the policy");
+ }
+}
+
+/// `full()` leaves the switch where the base config put it.
+#[test]
+fn full_access_keeps_the_configured_policy_switch() {
+ for enabled in [false, true] {
+ let mut config = openhuman_core::config::Config::default();
+ config.autonomy.enabled = enabled;
+ Access::full().apply(&mut config);
+ assert_eq!(config.autonomy.enabled, enabled);
+ }
+}