()
| 1041 | |
| 1042 | #[tokio::test] |
| 1043 | async fn test_no_timeout_when_confirmed() { |
| 1044 | let (event_tx, _) = broadcast::channel(100); |
| 1045 | let policy = ConfirmationPolicy { |
| 1046 | enabled: true, |
| 1047 | default_timeout_ms: 50, |
| 1048 | timeout_action: TimeoutAction::Reject, |
| 1049 | ..Default::default() |
| 1050 | }; |
| 1051 | let manager = ConfirmationManager::new(policy, event_tx); |
| 1052 | |
| 1053 | // Request confirmation |
| 1054 | let rx = manager |
| 1055 | .request_confirmation("tool-1", "bash", &serde_json::json!({})) |
| 1056 | .await; |
| 1057 | |
| 1058 | // Confirm immediately |
| 1059 | manager.confirm("tool-1", true, None).await.unwrap(); |
| 1060 | |
| 1061 | // Wait past timeout |
| 1062 | tokio::time::sleep(tokio::time::Duration::from_millis(100)).await; |
| 1063 | |
| 1064 | // Check timeouts - should be 0 since already confirmed |
| 1065 | let timed_out = manager.check_timeouts().await; |
| 1066 | assert_eq!(timed_out, 0); |
| 1067 | |
| 1068 | // Response should be approval (not timeout) |
| 1069 | let response = rx.await.unwrap(); |
| 1070 | assert!(response.approved); |
| 1071 | assert!(response.reason.is_none()); |
| 1072 | } |
| 1073 | } |
nothing calls this directly
no test coverage detected