Skip to content

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

test(embed): assert read-only denial in model tool results

Steven Enamakelf0371fb2249a
diff --git a/crates/openhuman-embed/tests/isolation_autonomy.rs b/crates/openhuman-embed/tests/isolation_autonomy.rs
index 5f7b6b5345..9526217a5c 100644
--- a/crates/openhuman-embed/tests/isolation_autonomy.rs
+++ b/crates/openhuman-embed/tests/isolation_autonomy.rs
@@ -8,8 +8,8 @@
mod common;
use common::{
- eventually, offline_config, route, runtime, scripted_provider, stub_backend,
- tool_call_completion,
+ chat_requests, eventually, offline_config, route, runtime, scripted_provider, stub_backend,
+ tool_call_completion, tool_results,
};
use openhuman_core::security::AutonomyLevel;
use openhuman_embed::{
@@ -71,12 +71,16 @@ fn every_agent_answers_policy_from_its_own_tier() {
)
.expect("a instantiates");
assert_eq!(a.config().autonomy.level, AutonomyLevel::ReadOnly);
- let a_out = a.run("write the marker").await.expect("a's turn returns");
+ a.run("write the marker").await.expect("a's turn returns");
assert!(!a_file.exists(), "a read-only agent must not write");
+ // The scripted final reply is advisory; the tool result sent back
+ // to the model proves the policy denied execution.
+ let a_requests = chat_requests(&a_provider).await;
+ let a_denial = tool_results(a_requests.get(1).expect("a continued after its tool call"));
assert!(
- a_out.reply.contains("read-only mode"),
+ a_denial.contains("[policy-blocked]") && a_denial.contains("read-only mode"),
"a's shell call is refused by its own tier: {}",
- a_out.reply
+ a_denial
);
// ── B: supervised, shell on its own allowlist; runs without parking ──