Skip to content

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

test(approval): pass ambient dispatch ctx in agent gate tests

Steven Enamakel4868ce8f5b73
diff --git a/crates/openhuman-core/src/security/approval/gate_agent_tests.rs b/crates/openhuman-core/src/security/approval/gate_agent_tests.rs
index 14f342e9a9..118cf1b565 100644
--- a/crates/openhuman-core/src/security/approval/gate_agent_tests.rs
+++ b/crates/openhuman-core/src/security/approval/gate_agent_tests.rs
@@ -233,11 +233,11 @@ async fn agents_parked_on_one_thread_id_are_routed_and_decided_apart() {
.expect("ApprovalRequested for alpha");
assert_eq!(seen.as_deref(), Some("route-alpha"));
- let alpha_rows = gate.list_pending_for_agent(Some("route-alpha")).unwrap();
+ let alpha_rows = gate.list_pending_for_agent(&crate::core::runtime::DispatchCtx::ambient(), Some("route-alpha")).unwrap();
assert_eq!(alpha_rows.len(), 1);
assert_eq!(alpha_rows[0].request_id, alpha_request);
assert_eq!(alpha_rows[0].agent_id.as_deref(), Some("route-alpha"));
- assert!(gate.list_pending_for_agent(None).unwrap().is_empty());
+ assert!(gate.list_pending_for_agent(&crate::core::runtime::DispatchCtx::ambient(), None).unwrap().is_empty());
let refused = gate
.decide_for_agent("route-alpha", &beta_request, ApprovalDecision::ApproveOnce)
@@ -267,7 +267,7 @@ async fn agents_parked_on_one_thread_id_are_routed_and_decided_apart() {
);
let denied = gate
- .deny_all_for_agent("route-beta", "agent_removed")
+ .deny_all_for_agent(&crate::core::runtime::DispatchCtx::ambient(), "route-beta", "agent_removed")
.unwrap();
assert_eq!(denied, 1);
let (outcome, _) = beta.await.unwrap();
@@ -295,7 +295,7 @@ async fn agents_parked_on_one_thread_id_are_routed_and_decided_apart() {
other => panic!("unexpected event {other:?}"),
}
assert!(gate
- .list_pending_for_agent(Some("route-beta"))
+ .list_pending_for_agent(&crate::core::runtime::DispatchCtx::ambient(), Some("route-beta"))
.unwrap()
.is_empty());
}
diff --git a/crates/openhuman-core/src/security/approval/store_persistence_tests.rs b/crates/openhuman-core/src/security/approval/store_persistence_tests.rs
index 8457a39088..4d342edc13 100644
--- a/crates/openhuman-core/src/security/approval/store_persistence_tests.rs
+++ b/crates/openhuman-core/src/security/approval/store_persistence_tests.rs
@@ -473,11 +473,11 @@ fn agent_id_round_trips_and_older_rows_read_as_the_process() {
)
.unwrap();
- let alpha = list_pending_for_agent(&config, Some("alpha")).unwrap();
+ let alpha = list_pending_for_agent(&crate::core::runtime::DispatchCtx::ambient(), &config, Some("alpha")).unwrap();
assert_eq!(alpha.len(), 1);
assert_eq!(alpha[0].request_id, "owned");
assert_eq!(alpha[0].agent_id.as_deref(), Some("alpha"));
- let process = list_pending_for_agent(&config, None).unwrap();
+ let process = list_pending_for_agent(&crate::core::runtime::DispatchCtx::ambient(), &config, None).unwrap();
assert_eq!(process.len(), 1);
assert_eq!(process[0].request_id, "process");