Skip to content

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

fix(tests): enable policy in tests that rely on security gates

Steven Enamakelc29dadfec548
diff --git a/crates/openhuman-core/src/security/policy/policy_allowlist_tests.rs b/crates/openhuman-core/src/security/policy/policy_allowlist_tests.rs
index d1a9335605..3f9eae679f 100644
--- a/crates/openhuman-core/src/security/policy/policy_allowlist_tests.rs
+++ b/crates/openhuman-core/src/security/policy/policy_allowlist_tests.rs
@@ -167,7 +167,12 @@ fn allowed_commands_include_windows_read_equivalents() {
#[test]
fn config_default_policy_includes_windows_read_equivalents() {
- let cfg = crate::config::AutonomyConfig::default();
+ // Explicitly enabled: the allowlist / risk gate this test is about only
+ // exists when the policy is on, and the shipped config default is off.
+ let cfg = crate::config::AutonomyConfig {
+ enabled: true,
+ ..crate::config::AutonomyConfig::default()
+ };
let p = SecurityPolicy::from_config(&cfg, std::path::Path::new("."), std::path::Path::new("."));
for command in [
"dir",
@@ -186,7 +191,12 @@ fn config_default_policy_includes_windows_read_equivalents() {
#[test]
fn config_default_policy_allows_prompt_date_command() {
- let cfg = crate::config::AutonomyConfig::default();
+ // Explicitly enabled: the allowlist / risk gate this test is about only
+ // exists when the policy is on, and the shipped config default is off.
+ let cfg = crate::config::AutonomyConfig {
+ enabled: true,
+ ..crate::config::AutonomyConfig::default()
+ };
let p = SecurityPolicy::from_config(&cfg, std::path::Path::new("."), std::path::Path::new("."));
assert!(
diff --git a/crates/openhuman-core/src/security/policy/policy_paths_and_risk_tests.rs b/crates/openhuman-core/src/security/policy/policy_paths_and_risk_tests.rs
index 76e1f2a540..11efff4485 100644
--- a/crates/openhuman-core/src/security/policy/policy_paths_and_risk_tests.rs
+++ b/crates/openhuman-core/src/security/policy/policy_paths_and_risk_tests.rs
@@ -390,7 +390,12 @@ fn write_to_not_yet_existing_path_in_workspace_still_allowed() {
fn config_default_auto_approve_includes_expanded_tools() {
// Issue #2486: verify read-only tools are auto-approved by default,
// and write tools are NOT (Supervised mode must prompt for edits).
- let cfg = crate::config::AutonomyConfig::default();
+ // Explicitly enabled: the allowlist / risk gate this test is about only
+ // exists when the policy is on, and the shipped config default is off.
+ let cfg = crate::config::AutonomyConfig {
+ enabled: true,
+ ..crate::config::AutonomyConfig::default()
+ };
// Pre-existing auto-approved tools must still be present
for tool in [