From 6c05cbf4bd401248c33d650e1d5a6ecd00b10280 Mon Sep 17 00:00:00 2001 From: KoNit-K <124019182+KoNit-K@users.noreply.github.com> Date: Tue, 15 Sep 2026 09:06:08 +0800 Subject: [PATCH] test(agent): make aux timeout FD test deterministic --- tests/agent/test_codex_aux_timeout_fd_ownership.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/agent/test_codex_aux_timeout_fd_ownership.py b/tests/agent/test_codex_aux_timeout_fd_ownership.py index 1758e13e14..0366e8f9b0 100644 --- a/tests/agent/test_codex_aux_timeout_fd_ownership.py +++ b/tests/agent/test_codex_aux_timeout_fd_ownership.py @@ -71,13 +71,15 @@ class TestCodexAuxiliaryTimeoutFdOwnership: shutdown(); the real close() must land on the owning thread in the adapter's ``finally``.""" - def _stalled(): - deadline = time.monotonic() + 30.0 - while time.monotonic() < deadline: - time.sleep(0.02) - yield SimpleNamespace(type="response.in_progress") + def _one_keepalive_then_block(): + # Let the owner process one keepalive, then keep it inside the + # stream past the watchdog window. The Timer is consequently + # the only deadline observer that can win this timeout. + yield SimpleNamespace(type="response.in_progress") + time.sleep(1.0) + yield SimpleNamespace(type="response.in_progress") - adapter, events = _adapter_with_recording_client(_stalled()) + adapter, events = _adapter_with_recording_client(_one_keepalive_then_block()) owner_tid = threading.get_ident() def _consume(stream, *, model, on_event):