[Feature]: Auto-retry transient Codex model-capacity errors with jittered backoff #12826
Problem or use case#
Codex can sometimes fail a turn with a transient capacity error such as:
Selected model is at capacity. Please try a different model.
When this happens in T3 Code, the user currently has to notice the failure and manually retry / resend even though the condition is often temporary.
For long-running or remotely controlled sessions, especially from mobile, this can unnecessarily stop work until the user comes back.
Proposed behavior#
Treat the Codex "model at capacity" condition (and the corresponding provider/app-server transient overload signal, where available) as a retryable transient failure.
T3 should retry the same turn automatically with a bounded exponential backoff plus randomized jitter, rather than a fixed-frequency loop.
For example, conceptually:
- retry delay increases after consecutive failures;
- each delay includes random jitter;
- honor provider
Retry-After/ equivalent metadata when available; - enforce a maximum delay and a maximum retry count or retry window;
- stop immediately if the user cancels/stops the turn;
- reset the retry state after a successful request.
The exact constants should be chosen by the project, but the important part is that retries are not synchronized at a fixed interval. Jittered backoff reduces retry storms and avoids repeatedly hammering the provider while it is overloaded.
UX#
While waiting, the thread could show something like:
Selected model is temporarily at capacity. Retrying automatically… attempt 2/5.
Optionally expose:
- Retry now
- Stop retrying
- Change model
Automatic retry should keep the originally selected model unless the user explicitly chooses another one. T3 should not silently change models.
Turn / transcript semantics#
A retry should be an implementation detail of the same logical user turn:
- do not append duplicate user messages;
- do not create multiple visible turns for each retry attempt;
- avoid duplicate execution if an earlier request actually started successfully but the client lost the response;
- preserve the original prompt, attachments, interaction mode, and selected model.
Scope#
This request is specifically about clearly transient capacity / server-overloaded failures. Authentication errors, invalid requests, policy errors, context-window errors, and other non-transient failures should not enter the same automatic retry loop.
Rate-limit errors could be handled separately or only retried when the provider gives an explicit retry hint.
Acceptance criteria#
- The Codex model-capacity error is classified as transient/retryable.
- T3 automatically retries the same logical turn.
- Retry timing uses bounded backoff with randomized jitter, not a fixed interval.
- Provider retry hints are respected when available.
- Retries stop after a bounded number of attempts / time window.
- User Stop/Cancel immediately cancels pending retries.
- No duplicate user messages or duplicate visible turns are created.
- T3 does not silently switch the selected model.
- The UI clearly indicates that it is waiting/retrying and allows the user to intervene.
- Non-transient Codex errors are not automatically retried by this mechanism.
Related area#
- Codex provider error classification
- provider turn orchestration
- retry scheduling / cancellation
- web/mobile turn status UI
Correction after comparing other threads on October 8. This incident is concentrated in one T3 thread. The evidence does not establish a provider-wide capacity outage.
On Linux, stock T3 Code nightly
0.0.46-nightly.20261005.2702, the affected tester thread changed from instancecodex_codex_2tocodexaround 14:29Z, preservinggpt-6.1-sol, xhigh reasoning and Standard/default tier.The pre-switch run at 14:28:59.883Z failed with HTTP 400 and
invalid_request_error: Sol was unsupported on that old ChatGPT-account route. That failure is distinct from the later capacity errors.After the switch, eight native turns on the same thread ended with:
{"error":{"message":"Selected model is at capacity. Please try a different model.","codex_error_info":"server_overloaded"}}The terminal times were 15:11:02.134, 15:12:39.554, 15:13:46.248, 15:15:48.726, 15:20:51.647, 15:30:36.285, 15:54:30.292 and 16:02:34.925Z. Some turns performed substantial tool work before failing. There were zero completed turns on this thread in the window beginning 14:00Z. A later turn was interrupted and the owner settled the thread; neither event is counted as a capacity failure.
At the 16:18:59Z read-only snapshot, eight other project threads on
codex/gpt-6.1-solhad zero failed runs since 14:00Z. Six of those had 20 completed runs in total, distributed as 9, 4, 4, 1, 1 and 1. Two were still running without a failure. These are scoped concurrent controls, not a claim about all users or all backend requests.The post-switch native thread's stored creator account/user identities match the default Pro account and a successfully completing peer. They differ from the separate old account. The T3 provider-thread record names the
codexshared session. This argues against retaining the old account identity in the observed metadata. It does not establish the backend cause or prove that every runtime cache was healthy. We have not identified a stale account/session binding that explains the failures.We initially suspected a queued cross-thread message had interrupted the tester. The native timeline disproves that: the queued handover started its next T3 run at 15:11:27.284Z, after the first capacity failure. Historical checks in that next run also found its session-owned helper and recorder still present, with a successful screenshot. Separate dashboard exits remain unattributed.
This report supports bounded continuation that preserves the selected model/effort/tier and avoids replaying completed actions. It also raises a narrower diagnostic question: why did one native conversation repeatedly return
server_overloadedwhile peer conversations on the same instance/model completed? The owner chose a fresh replacement thread after repeated failure. We did not change credentials, switch models, restart the shared provider or install a retry service.Nightly check on October 8: the newest published Nightly is
v0.0.46-nightly.20261008.2819, commit5e2225671f705fcd33f1ea5591b79ba612fb6974. Its Codex error handler records final native errors and distinguishes provider-reported retries. The terminal event builder still reports a failed reusable turn. I found no evidence here that the latest Nightly resolves this particular native conversation's final overload responses. This is scoped source/package inspection, not a new capacity test.The old unsupported account route was a local selection mismatch and the owner already corrected it before the overload sequence. The cause of the later native overloads remains unknown. I am not attributing them to a confirmed T3 defect or proposing a local credential, provider-session or automatic-retry patch without evidence. The helper exit cause also remains unproved.
Sign in to join this conversation.
Additional implementation evidence / working PoC:
I built a small experimental companion for this exact recovery path and have it working with Codex CLI / app-server:
https://github.com/wzyhn/codex-native-retry
The important finding is that this does not need to replay the failed prompt or inject a synthetic
continuemessage. It can use Codex's native empty-input continuation on the existing thread:That starts a new native turn in the same Codex thread while preserving the thread/session context. No new conversation is created, and the request does not override model, effort, permissions, sandbox, workspace, etc.
This seems especially relevant to #12825. The triage there already confirmed that T3's Codex adapter has
promptlessTurnContinuation: true, and thatCodexSessionRuntimecan issueturn/startwithout a prompt when the continuation input is empty. In other words, T3 appears to already have most of the provider-native primitive needed for this.Could #12826 be implemented by wiring the terminal capacity-error path directly into that existing promptless continuation path, instead of re-sending the original user message?
A few safety details from the working PoC may be useful:
serverOverloaded/server_overloadedcapacity failure.willRetry=true, do not add another retry loop; let Codex handle it.idle/systemError) and that the latest failed turn is still the same capacity failure.One semantic detail: the provider-native continuation creates a new native turn in the same thread, rather than replaying the old turn. T3 could still present this as one logical recovery flow in the UI so the transcript stays clean.
The Codex App's Start/play-style continuation is also the behavior I was trying to match: continuing the existing agent session without sending a fake user message. The PoC is not claiming byte-for-byte Desktop equivalence, but it demonstrates that the native app-server continuation primitive works in practice for this failure case.
If useful, the repo also includes protocol notes, safety invariants, retry scheduling, and equivalence notes that can be lifted into a T3-native implementation.