Skip to content

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

test(approval): give routing tests a stable park deadline

Steven Enamakel937aeb43e72b
diff --git a/src/openhuman/security/approval/gate_tests.rs b/src/openhuman/security/approval/gate_tests.rs
index 53a6e7a42e..9f21b952af 100644
--- a/src/openhuman/security/approval/gate_tests.rs
+++ b/src/openhuman/security/approval/gate_tests.rs
@@ -2,6 +2,12 @@ use super::*;
use tempfile::TempDir;
fn test_gate() -> (ApprovalGate, TempDir) {
+ test_gate_with_ttl(Duration::from_secs(2))
+}
+
+/// Build an approval gate with an explicit park deadline for tests that must
+/// coordinate a decision with a concurrently loaded full-suite executor.
+fn test_gate_with_ttl(ttl: Duration) -> (ApprovalGate, TempDir) {
let dir = TempDir::new().unwrap();
let config = Config {
workspace_dir: dir.path().to_path_buf(),
@@ -16,9 +22,9 @@ fn test_gate() -> (ApprovalGate, TempDir) {
// runners — the row would expire (and get denied by
// list_pending's lazy-expire) before `decide` could fire,
// surfacing as "pending row never appeared". 2s gives the
- // polling tests enough headroom while keeping
+ // most polling tests enough headroom while keeping
// `timeout_returns_deny` fast (PR #2367 CI flake).
- let gate = ApprovalGate::new(config, session, Duration::from_secs(2));
+ let gate = ApprovalGate::new(config, session, ttl);
(gate, dir)
}
diff --git a/src/openhuman/security/approval/gate_tests_part_02_tests.rs b/src/openhuman/security/approval/gate_tests_part_02_tests.rs
index bd08137f3d..77c8d82496 100644
--- a/src/openhuman/security/approval/gate_tests_part_02_tests.rs
+++ b/src/openhuman/security/approval/gate_tests_part_02_tests.rs
@@ -2,7 +2,10 @@ use super::*;
#[tokio::test]
async fn pending_for_thread_tracks_request_under_chat_context_and_clears() {
- let (gate, _dir) = test_gate();
+ // This test polls a parked task while the full Rust suite runs thousands
+ // of other tests concurrently. Keep its coordination deadline independent
+ // of the short TTL used by the timeout behavior tests.
+ let (gate, _dir) = test_gate_with_ttl(Duration::from_secs(10));
let gate = Arc::new(gate);
// Run intercept inside a scoped chat context + matching WebChat
@@ -56,7 +59,9 @@ async fn pending_for_thread_tracks_request_under_chat_context_and_clears() {
/// origin already carries, so the card can surface and be approved.
#[tokio::test]
async fn webchat_origin_routes_park_when_approval_chat_context_absent() {
- let (gate, _dir) = test_gate();
+ // See the companion chat-context routing test above: this is a
+ // coordination deadline, not the timeout behavior under test.
+ let (gate, _dir) = test_gate_with_ttl(Duration::from_secs(10));
let gate = Arc::new(gate);
// WebChat origin scoped, but NO `APPROVAL_CHAT_CONTEXT` — exactly the