From 0273821247ca47133c336d26514c92c3827929b6 Mon Sep 17 00:00:00 2001 From: mnajafian-nv Date: Fri, 16 Oct 2026 11:12:48 -0700 Subject: [PATCH 1/2] test: widen the Codex MCP login timeout margin The 5.1 s case failed whenever the runner took more than 100 ms before the adapter read the deadline. 5.9 s still checks rounding up to 6 and allows 900 ms of delay. Signed-off-by: mnajafian-nv --- tests/adapters/test_codex_adapter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/adapters/test_codex_adapter.py b/tests/adapters/test_codex_adapter.py index 231bf773f..c59900e26 100644 --- a/tests/adapters/test_codex_adapter.py +++ b/tests/adapters/test_codex_adapter.py @@ -858,7 +858,7 @@ async def block(*args, **kwargs): @pytest.mark.parametrize( ("invocation_timeout", "oauth_timeout", "expected_timeout"), - [(30, 12, 12), (5, 12, 5), (5.1, 12, 6)], + [(30, 12, 12), (5, 12, 5), (5.9, 12, 6)], ) def test_codex_logs_into_mcp_server_before_first_turn( codex_payload, From 40de8f4756fb126d5d23c5a18f2e352ee1c970af Mon Sep 17 00:00:00 2001 From: mnajafian-nv Date: Fri, 16 Oct 2026 11:20:22 -0700 Subject: [PATCH 2/2] test: give the Codex MCP login test an exact remaining budget A wider margin only made the timing failure rarer. Patch the adapter's remaining-time helper so the 5.1 s case checks rounding up without depending on runner speed. Signed-off-by: mnajafian-nv --- tests/adapters/test_codex_adapter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/adapters/test_codex_adapter.py b/tests/adapters/test_codex_adapter.py index c59900e26..32cb1bcfe 100644 --- a/tests/adapters/test_codex_adapter.py +++ b/tests/adapters/test_codex_adapter.py @@ -858,7 +858,7 @@ async def block(*args, **kwargs): @pytest.mark.parametrize( ("invocation_timeout", "oauth_timeout", "expected_timeout"), - [(30, 12, 12), (5, 12, 5), (5.9, 12, 6)], + [(30, 12, 12), (5, 12, 5), (5.1, 12, 6)], ) def test_codex_logs_into_mcp_server_before_first_turn( codex_payload, @@ -888,6 +888,9 @@ def test_codex_logs_into_mcp_server_before_first_turn( mock_codex.mcp_auth_statuses["remote"] = adapter.McpAuthStatus.not_logged_in open_browser = AsyncMock(return_value=True) monkeypatch.setattr(adapter, "_open_authorization_url", open_browser) + # Give the login an exact remaining budget, so the rounding check does not + # depend on how long the runner takes before the adapter reads the clock. + monkeypatch.setattr(adapter, "_remaining_timeout", lambda _: invocation_timeout) output = invoke_once(codex_payload)