Skip to content

The agent that grows with you

test(agent): make aux timeout FD test deterministic

KoNit-K6c05cbf4bd40
diff --git a/tests/agent/test_codex_aux_timeout_fd_ownership.py b/tests/agent/test_codex_aux_timeout_fd_ownership.py
index 1758e13e144..0366e8f9b07 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):