Skip to content

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

test(embed): cover the per-agent approval settings on Access (#7032)

oxoxDev0ad4de942e5c
diff --git a/crates/openhuman-embed/src/harness/access_tests.rs b/crates/openhuman-embed/src/harness/access_tests.rs
index 79c19fbdfa..0dee15bf46 100644
--- a/crates/openhuman-embed/src/harness/access_tests.rs
+++ b/crates/openhuman-embed/src/harness/access_tests.rs
@@ -140,3 +140,33 @@ fn an_explicit_origin_overrides_the_preset() {
})
));
}
+
+#[test]
+fn approval_lists_are_inherited_until_the_agent_sets_them() {
+ let mut config = Config::default();
+ config.autonomy.auto_approve = vec!["boot_tool".into()];
+ config.autonomy.auto_approve_all = true;
+
+ Access::supervised().apply(&mut config);
+ assert_eq!(config.autonomy.auto_approve, ["boot_tool"]);
+ assert!(config.autonomy.auto_approve_all);
+
+ Access::supervised()
+ .auto_approve(["shell", "file_write"])
+ .auto_approve_all(false)
+ .apply(&mut config);
+ assert_eq!(config.autonomy.auto_approve, ["shell", "file_write"]);
+ assert!(!config.autonomy.auto_approve_all);
+}
+
+#[test]
+fn the_approval_gate_switch_is_independent_of_the_tier() {
+ let access = Access::supervised().approval_gate(false);
+ assert!(!access.approval_gate_enabled());
+ let mut config = Config::default();
+ access.apply(&mut config);
+ assert_eq!(config.autonomy.level, AutonomyLevel::Supervised);
+ assert!(access.turn_origin().is_none());
+
+ assert!(Access::full().approval_gate(true).approval_gate_enabled());
+}