Compare commits

...

3 Commits

Author SHA1 Message Date
starr-openai
372630049d Interrupt delayed websocket accept on shutdown 2026-05-19 20:29:44 -07:00
starr-openai
72ff0247e1 Bound realtime sideband delay 2026-05-19 20:29:44 -07:00
Dylan Hurd
b283e736e5 test: deflake realtime sideband close test 2026-05-19 20:29:44 -07:00
2 changed files with 10 additions and 3 deletions

View File

@@ -1246,7 +1246,10 @@ pub async fn start_websocket_server_with_headers(
};
if let Some(delay) = connection.accept_delay {
tokio::time::sleep(delay).await;
tokio::select! {
_ = &mut shutdown_rx => return,
_ = tokio::time::sleep(delay) => {}
}
}
let response_headers = connection.response_headers.clone();

View File

@@ -649,6 +649,8 @@ async fn conversation_webrtc_start_posts_generated_session() -> Result<()> {
async fn conversation_webrtc_close_while_sideband_connecting_drops_pending_join() -> Result<()> {
skip_if_no_network!(Ok(()));
let sideband_accept_delay = Duration::from_secs(5);
let stale_sideband_observation_window = Duration::from_millis(700);
let server = start_mock_server().await;
Mock::given(method("POST"))
.and(path_regex(".*/realtime/calls$"))
@@ -662,7 +664,9 @@ async fn conversation_webrtc_close_while_sideband_connecting_drops_pending_join(
let realtime_server = start_websocket_server_with_headers(vec![WebSocketConnectionConfig {
requests: vec![vec![]],
response_headers: Vec::new(),
accept_delay: Some(Duration::from_millis(500)),
// Keep the sideband handshake pending beyond the stale-event observation window below
// without adding a multi-second fixed tail when the mock websocket server shuts down.
accept_delay: Some(sideband_accept_delay),
close_after_requests: false,
}])
.await;
@@ -708,7 +712,7 @@ async fn conversation_webrtc_close_while_sideband_connecting_drops_pending_join(
.await;
assert_eq!(closed.reason.as_deref(), Some("requested"));
let stale_event = timeout(Duration::from_millis(700), async {
let stale_event = timeout(stale_sideband_observation_window, async {
wait_for_event_match(&test.codex, |msg| match msg {
EventMsg::RealtimeConversationRealtime(RealtimeConversationRealtimeEvent {
payload: RealtimeEvent::Error(message),