Skip to content
Source
Sign inSign up
pingdotgg/t3code

Codex retry time limit counts time the Mac is asleep, and the error still says "2/5 retries" #37567

ClosedEtanHey(GitHub profile, opens in a new tab) opened this issue 4 comments

What happened

A Codex turn in a scheduled thread failed with "Provider error after 2/5 retries — request timed out" while my MacBook was asleep. The counter stayed at 2/5, so it looked like the thread was stuck with three retries left. In fact the turn had already been given up on.

Diagnosis

Codex retries for a turn get 10 minutes in total (PROVIDER_RETRY_BUDGET_MS in packages/provider-core/src/server/failure.ts). CodexAdapterV2 sets a timer for that deadline, and when it fires, failStalledProviderRetry fails the turn as not retryable, however many attempts Codex has left.

The timer counts time the Mac spends asleep. Here the first retry notice arrived during a short DarkWake, the Mac went back to sleep, and the 10 minutes ran out while it slept. The turn failed within half a second of the next wake, so Codex never got a retry with the network back.

The error item keeps the last notice's attempt: 2, maxAttempts: 5, which is why the UI says "after 2/5 retries" instead of saying the time limit ran out.

No log line names the budget, but the server trace has nothing on this thread between the retry notice and the failure, and the only other timeout (PROVIDER_RETRY_STALL_TIMEOUT, 15 minutes) wasn't due yet.

Steps to reproduce

  1. On macOS, start a Codex turn and drop the network so Codex starts retrying.
  2. Put the Mac to sleep for more than 10 minutes.
  3. Wake it.

Expected: retries continue once the network is back, or the error says the retry time limit was reached. Actual: the turn fails immediately, and the error reads "after 2/5 retries".

Version

0.1.10-nightly.20261115.4749

Environment

Desktop app with its local server, macOS 27.0 on Apple Silicon, on battery. codex-cli 0.169.0. The code is unchanged on main (16695c8).

Evidence

error item     first seen 05:48:53.88Z   failed 06:01:23.74Z
               transport_error, responseStreamDisconnected, retryable: false
               retry: { attempt: 2, maxAttempts: 5 }

pmset -g log (UTC)
05:48:13  DarkWake (45 s)    retry notice arrives
05:48:58  Sleep              10-min deadline passes at 05:58:53
06:01:23  DarkWake           turn fails

#28936, #17503 and #31446 (closed) were Codex retries hanging for hours, which the 10-minute limit seems to address. This is the other side of it: the limit ends a turn too early when the clock includes sleep. The stalled automation that followed is a separate issue.

Fix applied or workaround

None.

Filed by

Claude Opus 5.5 in Claude Code, following the t3 triage playbook.

  1. EtanHey(GitHub profile, opens in a new tab) added labelsvia-triage

  2. tanstack-source added labelsbug

  3. Related issues and pull requests. None of them reports this bug.

    • #29208 (merged Nov 14) added the 10-minute retry limit, to stop Codex turns from waiting forever for the network. This issue is a side effect of that change: the limit's clock keeps running while the Mac sleeps, so a turn can use up its whole 10 minutes asleep and fail as soon as the Mac wakes.
    • #28936, #17503, #31446 (closed) were the original reports of Codex turns hanging for hours in retries. That's the opposite problem (no limit at all), which #29208 fixed.

    A fix could pause or restart the limit across sleep and wake, and say "retry time limit reached" when it fires, instead of "after 2/5 retries".

  4. I tried to reproduce this on the current build and could not.

    On origin/main d68a2fa673 I ran the existing CodexAdapterV2 replay test 'fails a stalled 429 provider retry as a usage limit and stops the Codex turn' (vp test run apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts -t "fails a stalled 429"). Codex sends retry notices 1/5 and 2/5, and the test clock moves past the 10-minute PROVIDER_RETRY_BUDGET_MS. The turn fails with retry.attempt 2 and failure.message 'exceeded retry limit, last status: 429 Too Many Requests'. Nothing says the retry time limit ended it, so the web label reads 'Usage limit reached/Provider error after 2/5 retries'. I added one assertion that the message names the time limit; it fails on main (branch factory/repro-37567, commit 06e92eafc1). I could not run the reporter's real case: macOS sleep during a live Codex retry needs a Mac and Codex ChatGPT auth, and this Linux VM has neither. Linux CLOCK_MONOTONIC also does not count suspend.

    Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.

  5. juliusmarminge closed this

  6. EtanHey(GitHub profile, opens in a new tab)commented

    @juliusmarminge Thanks for checking. Your test reproduces half of it: the assertion that the message names the time limit fails on main, so the "after 2/5 retries" label is confirmed.

    The other half is macOS-only, which is why a Linux VM can't show it (as you noted, CLOCK_MONOTONIC there doesn't count suspend). On my Mac the deadline clearly counted sleep:

    • 05:48:53Z: retry notice 2/5, during a 45 s DarkWake
    • 05:48:58Z: Mac sleeps; the 10-min deadline (05:58:53Z) passes while asleep
    • 06:01:23Z: DarkWake; the turn fails 0.4 s later, with no provider event in between (server trace)

    The Mac was awake for about 5 s in total after the retry notice. A deadline that excluded sleep could not have fired then.

    Steps (macOS, Codex with ChatGPT auth):

    1. Start a Codex turn, then turn off Wi-Fi so Codex starts retrying ("Reconnecting… 1/5").
    2. Close the lid on battery for 11+ minutes.
    3. Open it. The turn fails immediately with "Provider error after N/5 retries", not retryable.

    Version: 0.1.10-nightly.20261115.4749 (desktop app + local server), macOS 27.0, Apple Silicon. Could you reopen?

  7. It happened again last night, this time on a Claude turn, on a newer build (0.1.10-nightly.20261116.4800). So it isn't Codex-only: ClaudeAdapterV2.ts arms the same 10-minute PROVIDER_RETRY_BUDGET_MS with Effect.delay, and that timer also keeps counting while the Mac sleeps.

    Lid closed on battery at 20:00Z. Server records and pmset -g log (UTC):

    • 20:26:05Z: turn starts during a 2 s DarkWake
    • 20:41:08Z: retry notice 5/10 ("Claude API unknown"), during another 2 s DarkWake; Mac sleeps again at 20:41:10
    • 20:50:00–20:50:45Z: the only other time the Mac is awake
    • 20:57:07Z: DarkWake; the turn fails in the same second, retryable: false, labelled "Provider error after 5/10 retries"

    Between the retry notice and the failure the Mac was awake for about 47 s, yet the 10-minute limit (and the 15-minute stall timer) both ran out. Nothing resumes the turn after wake, so the thread just sits failed until someone sends a message.

Sign in to join this conversation.