Remap Codex short 429s to retryable rate limits - #710
Conversation
intx paints a bare Codex ChatGPT 429 as quota exhaustion even when the turn retries and succeeds. Keep usage_limit_reached with reset ETA as quota_exhausted; remap other known-Codex 429s so retry/backoff and transcript copy match the known-xAI short-limit path.
A committed credential_failure is terminal auth death. The previous line claimed a refresh was already in flight, which is not what the harness does.
TheGreatAxios
left a comment
There was a problem hiding this comment.
Lens: critic. Verdict: no blocking findings.
This branch remaps known-Codex short 429s to retryable rate limits, keeps usage_limit_reached responses on the quota path, and changes terminal credential-failure copy to ask for login again. The branch includes retry-policy, normalization, message, and TUI copy coverage. I found no blocking or should-fix correctness issues.
TheGreatAxios
left a comment
There was a problem hiding this comment.
Review · Comment
Known-Codex short 429s remap to retryable rate limits; usage_limit_reached stays quota-exhausted; terminal credential copy asks the operator to log in again.
No findings.
TheGreatAxios
left a comment
There was a problem hiding this comment.
Critic · Comment
Known-Codex short 429s remap to retryable on the same dual-path as xAI. Terminal credential copy no longer claims a refresh is in flight.
Findings
src/inference-error-message.ts:25— everycredential_failureuses "Authentication failed — log in again." There is still one string for recovered and terminal 403s, and no test pins the difference. A leftover recovered 403 row (handoff expires on anything other thaninference.retry/inference.start) tells the operator to log in even if the turn continues. Retraction belongs to PR #711; this branch still lacks the recovered-vs-terminal copy test CL-7174 listed.
Notes
- Remap, backoff,
usage_limit_reached, and non-Codex 429s match CL-7173.
TheGreatAxios
left a comment
There was a problem hiding this comment.
Neckbeard · Comment
Codex short-429 transcript copy reuses the xAI remap string.
Findings
src/inference-gateway-error.ts:52— Codex returnsXAI_RATE_LIMIT_USER_MESSAGEwhile the JSDoc still says known-xAI. Rename or alias so a later xAI-only edit cannot retarget Codex.src/inference-error-message.ts:98— two consecutiveifs return the same constant; the comment already treats them as one case.src/agent/retry-policy.test.ts:76— title says "bare 429"; the fixture is ChatGPT usage-limit prose.
TheGreatAxios
left a comment
There was a problem hiding this comment.
Review · Comment
Remaps known-Codex HTTP 429s that lack a usage_limit_reached body to retryable, and changes the credential_failure transcript line to "Authentication failed — log in again."
Findings
src/inference-gateway-error.ts:301-314— the remap only exempts bodiesparseCodexUsageLimitErrorrecognizes, which needs an exactcodefield (src/auth/codex/usage-limit-error.ts:76-79). A prose-only "usage limit" body with an hour-longRetry-Afterbecomesretryable, bypassing theMAX_BLIND_WAIT_MSabort (src/agent/retry-policy.ts:41-47) and hitting the exhausted account twice more before aborting. The xAI path (:241-254) keepsquota_exhaustedon prose markers. CL-7173 asks for this, so it is a deliberate choice — butsrc/inference-gateway-error.test.ts:342-353pins the remap of usage-limit prose, so if OpenAI ships the real cap as prose this becomes a silent regression relative to the xAI approach. Could the Codex path keep the marker check for thequota_exhaustedcase as well?src/inference-error-message.ts:99— on the final aborted attempt the transcript still reads "Rate limited — retrying…". Same shape as the pre-existing xAI line at:98; noting because it is the same class CL-7174 is about.
Notes
credential_failurecopy is global, not Codex-only. Verified no refresh-on-401 in the inference path (grep -n "401\|credential\|refresh" src/agent/director.ts), so "log in again" is accurate.- Checks:
bun run typecheck,bun run lint,bun test src/agent/retry-policy.test.ts src/inference-gateway-error.test.ts src/inference-error-message.test.ts src/tui/stream-event-map.test.ts(74 pass). Repro of the prose-body case:retryAfterMs 3.6M→ retry/retry/abort undercodex, immediate abort underopenai. - Commit
57b479b4"Pin TUI copy for Codex short 429s and credential failure" also touchessrc/agent/retry-policy.test.ts.
Summary
Verification
Fixes CL-7173
Fixes CL-7174