diff --git a/server/src/agents/pty/mod.rs b/server/src/agents/pty/mod.rs index a672b496..f81a40fc 100644 --- a/server/src/agents/pty/mod.rs +++ b/server/src/agents/pty/mod.rs @@ -208,21 +208,19 @@ mod tests { /// by the backoff duration so the watchdog doesn't kill the agent while /// it's legitimately waiting for the limit to clear. /// - /// Script emits a hard-block event with reset_at = now + 3s, then sleeps - /// 3s, then exits. With inactivity_timeout_secs = 1, the run would fail - /// without the extension; with it, the deadline is bumped to ~4s and the - /// script gets to complete cleanly. + /// Script emits a hard-block event with reset_at in the far future, then + /// sleeps 3s, then exits. With inactivity_timeout_secs = 1, the run + /// would normally fail at the 1s mark; with the extension the deadline + /// is bumped past the sleep and the script completes cleanly. The + /// far-future reset_at avoids wall-clock races under cargo-test load. #[tokio::test] async fn rate_limit_hard_block_extends_inactivity_deadline() { use std::os::unix::fs::PermissionsExt; let tmp = tempfile::tempdir().unwrap(); let script = tmp.path().join("emit_then_wait.sh"); - let reset_at = chrono::Utc::now() + chrono::Duration::seconds(3); - let reset_at_str = reset_at.to_rfc3339_opts(chrono::SecondsFormat::Secs, true); - let body = format!( - "#!/bin/sh\nprintf '%s\\n' '{{\"type\":\"rate_limit_event\",\"rate_limit_info\":{{\"status\":\"hard_block\",\"reset_at\":\"{reset_at_str}\"}}}}'\nsleep 3\n" - ); + let body = + "#!/bin/sh\nprintf '%s\\n' '{\"type\":\"rate_limit_event\",\"rate_limit_info\":{\"status\":\"hard_block\",\"reset_at\":\"2099-01-01T12:00:00Z\"}}'\nsleep 3\n"; std::fs::write(&script, body).unwrap(); std::fs::set_permissions(&script, std::fs::Permissions::from_mode(0o755)).unwrap();