request_max_retries not being honored

Resolved 💬 1 comment Opened Sep 1, 2025 by o1lo01ol1o Closed Dec 12, 2025

What version of Codex is running?

codex-cli 0.27.0 (also whatever @native currenty builds)

Which model were you using?

gpt-5

What platform is your computer?

Darwin 23.1.0 arm64 arm

What steps can reproduce the bug?

in ~/.codex/config.toml:

# Make model/provider explicit so the right provider block is used
model = "gpt-5"
model_provider = "openai"
model_reasoning_effort = "high"
# OpenAI via Responses API (used for GPT‑5)
[model_providers.openai]
name = "OpenAI"
base_url = "https://api.openai.com/v1"
env_key = "OPENAI_API_KEY"             # Per‑provider network tuning (overrides built‑in defaults)
request_max_retries = 40               # default is 4
stream_max_retries = 100               # default is 5
stream_idle_timeout_ms = 300000        # default is 300000 (5m)
wire_api = "responses"

Have tier 1 rate limits on your account (or I guess just disconnect from the internet?). Then observe:

⚠  stream error: stream disconnected before
completion: Rate limit reached for gpt-5 in
organization org-x on tokens
per min (TPM): Limit 30000, Used 25982, Requested
12644. Please try again in 17.252s. Visit https://
platform.openai.com/account/rate-limits to learn
more.; retrying 1/5 in 207ms…

⚠  stream error: stream disconnected before
completion: Rate limit reached for gpt-5 in
organization org-x  on tokens
per min (TPM): Limit 30000, Used 25450, Requested
12644. Please try again in 16.187s. Visit https://
platform.openai.com/account/rate-limits to learn
more.; retrying 2/5 in 404ms…

⚠  stream error: stream disconnected before
completion: Rate limit reached for gpt-5 in
organization org-x  on tokens
per min (TPM): Limit 30000, Used 24808, Requested
12644. Please try again in 14.904s. Visit https://
platform.openai.com/account/rate-limits to learn
more.; retrying 3/5 in 865ms…

⚠  stream error: stream disconnected before
completion: Rate limit reached for gpt-5 in
organization org-x  on tokens
per min (TPM): Limit 30000, Used 23975, Requested
12644. Please try again in 13.238s. Visit https://
platform.openai.com/account/rate-limits to learn
more.; retrying 4/5 in 1.584s…

⚠  stream error: stream disconnected before
completion: Rate limit reached for gpt-5 in
organization org-x  on tokens
per min (TPM): Limit 30000, Used 22765, Requested
12644. Please try again in 10.818s. Visit https://
platform.openai.com/account/rate-limits to learn
more.; retrying 5/5 in 3.199s…

Be sad, because you cannot reasonably spend $50 this way and thus, cannot increase your tier.

What is the expected behavior?

_No response_

What do you see instead?

_No response_

Additional information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗