From 49ade3ad228a7a0dfc68db4e6eec70c7b3315544 Mon Sep 17 00:00:00 2001 From: Edgar Arakelyan Date: Sun, 15 Nov 2026 09:19:27 -0800 Subject: [PATCH] test(drivers): the codex-computer-use idle test gives two calls in a row room on a busy runner With IDLE_S at 0.2 s, a busy CI runner let the driver close the REPL between the test's set and get, so the get found a fresh one ("None in 6467") and the test failed. The idle window is now 1 s, and the wait for the REPL to close is 5 s. Co-Authored-By: Claude Opus 5.5 --- tst/unit/drivers/codex_computer_use_driver_test.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tst/unit/drivers/codex_computer_use_driver_test.py b/tst/unit/drivers/codex_computer_use_driver_test.py index f701d27d0..ec1c805dd 100644 --- a/tst/unit/drivers/codex_computer_use_driver_test.py +++ b/tst/unit/drivers/codex_computer_use_driver_test.py @@ -98,6 +98,9 @@ async def main(): anyio.run(main) ''') +#: How long a REPL may sit unused before the driver closes it, in the idle test: well over two calls in a row on a busy +#: runner, so the second still finds the first's REPL. +IDLE_S = 1.0 MACOS = Platform(os="macos", version="26.5", arch="arm64", display="aqua") WINDOWS = Platform(os="windows", version="11", arch="amd64", display="dwm") @@ -184,8 +187,8 @@ def _text(result) -> str: return " ".join(c.text for c in result.content if c.type == "text") -async def _gone(pid: int) -> bool: - for _ in range(200): +async def _gone(pid: int, within_s: float = 5.0) -> bool: + for _ in range(int(within_s / 0.01)): try: os.kill(pid, 0) except ProcessLookupError: @@ -357,7 +360,7 @@ async def js(caller: str, code: str) -> str: @pytest.mark.asyncio async def test_a_repl_left_idle_is_closed_without_another_call_and_its_session_starts_afresh(module, monkeypatch): monkeypatch.setattr(module, "SWEEP_S", 0.05) - monkeypatch.setattr(module, "IDLE_S", 0.2) + monkeypatch.setattr(module, "IDLE_S", IDLE_S) async with mcp_session(_driver(module, monkeypatch)) as session: await session.call_tool("js", {"code": "set 1"}, meta={SESSION_META_KEY: "a"}) before = _text(await session.call_tool("js", {"code": "get"}, meta={SESSION_META_KEY: "a"}))