interplane.Get Omega
Read in your language

aegis-runtime-mv

Native Rust agent runtime: Axum WebSocket/SSE/REST gateway, heartbeat scheduler, dependency-aware task workflow, SQLite storage. Attachment of AienOS. Pre-alpha.

Brought by drakestapleton

branch main Branches Tags History

aegis-runtime-mv / tests / probe_gate_tests.rs

34 lines · 1403 bytes Raw Blame History
1//! Probe gating is wired into every dispatch path. With the strictest
2//! threshold the reference oracle refuses, so a path that skips the gate
3//! would run the command. Separate test binary: it sets a process env var.
4
5use aegis::{SkillExecutionRequest, SkillRegistry, WorkspaceCapability};
6
7#[tokio::test]
8async fn strict_probe_threshold_refuses_on_every_path() {
9 std::env::set_var("AIEN_PROBE_ENFORCE", "1.0");
10 let dir = tempfile::tempdir().unwrap();
11 let registry = SkillRegistry::with_workspace(WorkspaceCapability::new(dir.path()).unwrap());
12
13 let req = SkillExecutionRequest {
14 skill_name: "bash_eval".to_string(),
15 arguments: serde_json::json!({ "command": "ls" }),
16 };
17 let res = registry.execute_gated(&req).await;
18 assert!(!res.success, "skill ran past the probe gate");
19 assert!(res.error.unwrap_or_default().contains("probe"));
20
21 let shell = registry
22 .workspace()
23 .dispatch_shell_gated("ls", None, 5)
24 .await;
25 let err = shell.expect_err("shell ran past the probe gate");
26 assert!(err.to_string().contains("probe"), "{}", err);
27
28 let write = SkillExecutionRequest {
29 skill_name: "write_file".to_string(),
30 arguments: serde_json::json!({ "path": "gated.txt", "content": "x" }),
31 };
32 assert!(!registry.execute_gated(&write).await.success);
33 assert!(!dir.path().join("gated.txt").exists());
34}