Skip to content

Remap Codex short 429s to retryable rate limits - #710

Merged
TheGreatAxios merged 4 commits into
mainfrom
cl-7173-treat-codex-short-429s-as-retryable-rate-limits
Aug 28, 2026
Merged

Remap Codex short 429s to retryable rate limits#710
TheGreatAxios merged 4 commits into
mainfrom
cl-7173-treat-codex-short-429s-as-retryable-rate-limits

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Known-Codex short HTTP 429s now normalize to retryable rate limits instead of quota exhaustion
  • Codex usage_limit_reached responses keep the reset/profile quota-exhausted copy
  • Terminal credential failures now tell the operator to log in again instead of claiming re-authentication is in flight

Verification

  • 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
  • bun run check

Fixes CL-7173
Fixes CL-7174

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.
@linear-code

linear-code Bot commented Aug 28, 2026

Copy link
Copy Markdown

CL-7173

CL-7174

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 — every credential_failure uses "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 than inference.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 TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neckbeard · Comment

Codex short-429 transcript copy reuses the xAI remap string.

Findings

  • src/inference-gateway-error.ts:52 — Codex returns XAI_RATE_LIMIT_USER_MESSAGE while 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 consecutive ifs 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 TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 bodies parseCodexUsageLimitError recognizes, which needs an exact code field (src/auth/codex/usage-limit-error.ts:76-79). A prose-only "usage limit" body with an hour-long Retry-After becomes retryable, bypassing the MAX_BLIND_WAIT_MS abort (src/agent/retry-policy.ts:41-47) and hitting the exhausted account twice more before aborting. The xAI path (:241-254) keeps quota_exhausted on prose markers. CL-7173 asks for this, so it is a deliberate choice — but src/inference-gateway-error.test.ts:342-353 pins 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 the quota_exhausted case 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_failure copy 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 under codex, immediate abort under openai.
  • Commit 57b479b4 "Pin TUI copy for Codex short 429s and credential failure" also touches src/agent/retry-policy.test.ts.

@TheGreatAxios
TheGreatAxios merged commit 198afce into main Aug 28, 2026
5 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-7173-treat-codex-short-429s-as-retryable-rate-limits branch August 28, 2026 22:02
TheGreatAxios added a commit that referenced this pull request Aug 28, 2026
sendFailureText rematched the #710 credential_failure line against
raw-provider auth patterns and replaced it with the generic other
copy. #711 tests still expected the pre-#710 session-expired string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant