The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(approval): replace list_pending polling with waiter-key observation
Steven Enamakel968efd0b704b
diff --git a/src/openhuman/security/approval/gate_tests.rs b/src/openhuman/security/approval/gate_tests.rsindex 98f7b0a0e0..418b60af7d 100644--- a/src/openhuman/security/approval/gate_tests.rs+++ b/src/openhuman/security/approval/gate_tests.rs@@ -53,6 +53,13 @@ fn test_gate_with_ttl(ttl: Duration) -> (ApprovalGate, TempDir) {(gate, dir)}+/// Return a request id after the approval row has been persisted and its+/// waiter has been registered. Unlike `list_pending`, this observation does+/// not lazily expire the row while a short-TTL test is waiting for insertion.+fn parked_request_id(gate: &ApprovalGate) -> Option<String> {+ gate.waiters.lock().keys().next().cloned()+}+/// A gate for the tests that let a park expire, plus the env lock they/// hold until the pending row captures its effective TTL.///diff --git a/src/openhuman/security/approval/gate_tests_part_02_tests.rs b/src/openhuman/security/approval/gate_tests_part_02_tests.rsindex a985df5e64..77fb04a46b 100644--- a/src/openhuman/security/approval/gate_tests_part_02_tests.rs+++ b/src/openhuman/security/approval/gate_tests_part_02_tests.rs@@ -613,14 +613,11 @@ async fn intercept_with_workflow_require_approval_persists_and_ttl_denies() {});let mut tries = 0;- loop {- if !gate.list_pending().unwrap().is_empty() {- break;- }+ while parked_request_id(&gate).is_none() {tries += 1;assert!(tries < 50,- "audit row never appeared for require_approval workflow origin"+ "approval waiter never appeared for require_approval workflow origin");tokio::time::sleep(Duration::from_millis(10)).await;}diff --git a/src/openhuman/security/approval/gate_tests_part_03_tests.rs b/src/openhuman/security/approval/gate_tests_part_03_tests.rsindex 34f5b8d85c..899dc68566 100644--- a/src/openhuman/security/approval/gate_tests_part_03_tests.rs+++ b/src/openhuman/security/approval/gate_tests_part_03_tests.rs@@ -470,15 +470,15 @@ async fn decide_approve_always_for_flow_then_insert_flow_trust_composes_to_auto_.await});- let pending = loop {- if let Some(p) = gate.list_pending().unwrap().into_iter().next() {- break p;+ let request_id = loop {+ if let Some(request_id) = parked_request_id(&gate) {+ break request_id;}tokio::time::sleep(Duration::from_millis(10)).await;};let decided = gate- .decide(&pending.request_id, ApprovalDecision::ApproveAlwaysForFlow)+ .decide(&request_id, ApprovalDecision::ApproveAlwaysForFlow).unwrap().expect("decided row");