Repository navigation
Description
Summary
When Account Pooler has no eligible Codex account until a future quota reset, it returns a generic HTTP 429 with a potentially hours-long Retry-After. Codex interprets that as a retryable transport failure and sleeps inside the active turn, displaying Reconnecting... 1/5. That turn continues occupying a shared concurrency slot; when those slots fill, otherwise runnable threads, including Claude threads with available accounts, wait behind them.
The defect is the quota-exhaustion response contract between Account Pooler and Codex. Concurrency Limit is counting the active turns it is given, and Provider Retry cannot schedule a replacement until the turn actually fails.
Revision and verification scope
- Inspected bb at
ab04f0450fef0bbbc6f80f733a9a5f7d97077c2e; the relevant pool, bridge, retry, concurrency, and error-display files are unchanged onmainatcc292b975fc35e16d7480cd9b8d55eff0ed88d8f. - Verified the provider boundary using the real Codex executable, an isolated credential/config directory, and a synthetic HTTP endpoint. No real account, model inference, or quota expenditure is required.
- The first fixture used bb's actual
createCodexAdapter().errorResponse()to generate the response. The portable reproducer below uses its identical JSON shape. - Full-app replay remains unverified: isolated bb startup was blocked by resource admission. The shared-queue consequence is supported by the incident event sequence and the source paths below, rather than a newly completed whole-app e2e run.
Steps to reproduce
Run the following as python3 reproduce.py in a scratch directory with codex on PATH. It uses a temporary configuration directory, a dynamically assigned loopback endpoint, and fake responses only. Each subprocess is stopped after eight seconds if it has not ended.
The three cases differ only in the response header/body:
- Pooler's current generic 429 plus
Retry-After: 86400. - The same generic 429 without
Retry-After. error.type: usage_limit_reachedwith the sameRetry-Afterand an explicit reset time.
Complete portable reproducer
import http.server
import json
import os
import signal
import subprocess
import tempfile
import threading
import time
mode = 'generic'
class Handler(http.server.BaseHTTPRequestHandler):
def log_message(self, *args):
pass
def do_POST(self):
self.rfile.read(int(self.headers.get('Content-Length', '0')))
error = {'message': 'No Account Pooler account is currently eligible.',
'type': 'rate_limit_error', 'code': 'rate_limit_exceeded'}
if mode == 'typed':
error = {'message': 'Fixture quota exhausted',
'type': 'usage_limit_reached',
'resets_at': int(time.time()) + 86400}
self.send_response(429)
self.send_header('Content-Type', 'application/json')
if mode != 'no-header':
self.send_header('Retry-After', '86400')
self.end_headers()
self.wfile.write(json.dumps({'error': error}).encode())
server = http.server.ThreadingHTTPServer(('127.0.0.1', 0), Handler)
threading.Thread(target=server.serve_forever, daemon=True).start()
with tempfile.TemporaryDirectory(prefix='.codex-quota-repro-', dir='.') as scratch:
env = dict(os.environ, CODEX_HOME=os.path.abspath(scratch))
for key in ['OPENAI_API_KEY', 'CODEX_OPENAI_BASE_URL', 'CODEX_POOL_AUTH_TOKEN']:
env.pop(key, None)
config = {
'model_provider': 'fixture',
'model_providers.fixture.name': 'fixture',
'model_providers.fixture.base_url': f'http://127.0.0.1:{server.server_port}',
'model_providers.fixture.wire_api': 'responses',
'model_providers.fixture.requires_openai_auth': False,
'model_providers.fixture.supports_websockets': False,
'model_providers.fixture.request_max_retries': 0,
}
command = ['codex', 'exec', '--ephemeral', '--skip-git-repo-check', '--json',
'-m', 'gpt-5.4', '--cd', os.path.abspath(scratch)]
for key, value in config.items():
command += ['-c', key + '=' + json.dumps(value)]
command += ['Reply only with ok. Do not use tools.']
for mode in ['generic', 'no-header', 'typed']:
child = subprocess.Popen(command, env=env, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
text=True, start_new_session=True)
started = time.monotonic()
timed_out = False
try:
stdout, _ = child.communicate('', timeout=8)
except subprocess.TimeoutExpired:
timed_out = True
os.killpg(child.pid, signal.SIGTERM)
stdout, _ = child.communicate()
print(json.dumps({'case': mode, 'still_running_after_8s': timed_out,
'elapsed_seconds': round(time.monotonic()-started, 2)}))
for line in stdout.splitlines():
try:
event = json.loads(line)
except json.JSONDecodeError:
continue
if event.get('type') in ['error', 'turn.failed']:
print(json.dumps(event))
server.shutdown()
server.server_close()To exercise the queue consequence in bb: enable Account Pooler and Concurrency Limit, set the overall limit to one, and run a pooled Codex thread when every enabled Codex account is exhausted with a future reset. After its reconnect event, submit a Claude thread with an available Claude account. Check the active Codex turn, the waiting Claude message, and bb provider-retry status <codex-thread-id>. This whole-app sequence is the outstanding verification step, not a claimed fresh e2e pass.
Expected versus actual
A known subscription-quota exhaustion should end or suspend the provider attempt in a way that releases its admission slot and lets bb schedule an explicit rate-limit retry using the pool's availability. The thread should show a quota wait and reset time, rather than appear to be reconnecting indefinitely.
Actual portable-repro output (the generic case is terminated by the fixture):
{"case": "generic", "still_running_after_8s": true, "elapsed_seconds": 8.03}
{"type": "error", "message": "Reconnecting... 1/5 (exceeded retry limit, last status: 429 Too Many Requests)"}
{"case": "no-header", "still_running_after_8s": false, "elapsed_seconds": 0.15}
{"type": "error", "message": "exceeded retry limit, last status: 429 Too Many Requests"}
{"type": "turn.failed", "error": {"message": "exceeded retry limit, last status: 429 Too Many Requests"}}
{"case": "typed", "still_running_after_8s": false, "elapsed_seconds": 0.15}
The typed case additionally emits a usage-limit error with the reset time and turn.failed. The original incident's stored events similarly contain HTTP 429, willRetry: true, and no terminal failure before manual interruption. Provider Retry had no corresponding new scheduling decision.
Root cause and evidence
- Pooler computes Retry-After from the earliest account reset, including long subscription windows.
- Its Codex adapter serializes every 429 as rate_limit_error / rate_limit_exceeded, losing the distinction between exhausted subscription quota and transient request pacing.
- Codex maps a generic HTTP 429 to RetryLimit, but recognizes usage_limit_reached separately. RetryLimit becomes retryable when server retry advice exists; UsageLimitReached is terminal. The stream retry loop emits Reconnecting and sleeps until that deadline.
- bb's bridge does not trigger quota recovery for a retrying provider error. Provider Retry listens for turn.failed, which has not happened.
- Concurrency Limit counts all running threads, without separating providers. Running includes starting and active.
- Timeline display prioritizes Reconnecting over the structured error category, explaining the misleading presentation.
Investigation: BB-Thread-ID thr_ytwc3phrmg.
What was ruled out
- The response-body/header controls isolate the trigger; this does not require an actual network disconnect.
- This is distinct from Provider Retry failing to retry completed pool failures: here the provider has not completed its failure, so that fix is never reached.
- Available Claude quota does not make Codex accounts eligible; the cross-provider coupling is the shared admission limit.
- The tested bb source paths are still present on the checked
mainrevision. - No production account settings or concurrency limits were changed during investigation.
Suggested fix direction
Preserve the distinction between known Codex subscription exhaustion and transient 429 pacing. A structured quota-exhausted response can hand control back to bb's existing pool-aware retry scheduler; verify its reset metadata, queue release, and early account recovery end to end. Keep transient pacing behavior intact. Merely excluding reconnecting turns from concurrency counts would be unsafe because they could wake without acquiring admission again.
AGENT GENERATED
Activity
bb-slop-cop commentedon Oct 22, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotproviders,plugins,provider-codex, andpartial-reprolabels preserved.cc292b975.rate_limit_error/rate_limit_exceeded, with a roughly day-longRetry-After, losing the machine-readable distinction from transient pacing.partial-repro.vadikhq commentedon Nov 29, 2026
I saw this on bb Desktop 0.50.1 and reproduced it in isolation with Codex CLI 0.172.0. In the affected turn, bb logged HTTP 429 and “Reconnecting... 1/5”. The turn stayed active for over seven minutes, until the host daemon disconnected. Provider Retry then identified a future pool reset.
I tested a small change against current main. When the pool confirms subscription quota exhaustion for all usable Codex accounts, return 429 with
error.type: "usage_limit_reached"and the earliest known availability aserror.resets_atin Unix seconds. Keep the existing response for transient pacing and other errors.I served the responses generated by the before and after code to the real CLI over loopback with test data. The original response was still reconnecting at the upstream fixture’s eight-second cutoff. The patched response produced
turn.failedwith “You’ve hit your usage limit” in under 0.1 seconds, both with and without a known reset. The full desktop test and retry queue remain unverified.Could you include this response change in a desktop release?