litellm - 💡(How to fix) Fix [Bug]: Codex CLI via LiteLLM proxy appears to enter retry/fallback loop in real sessions [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#26061Fetched 2026-04-19 15:06:02
View on GitHub
Comments
1
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
closed ×1commented ×1labeled ×1

When using Codex CLI through LiteLLM proxy, requests can appear to enter a retry/fallback loop (repeated web-searching/retry behavior), causing long turns and unstable UX.

Error Message

  • Clear non-retriable error path when request shape is incompatible

Root Cause

When using Codex CLI through LiteLLM proxy, requests can appear to enter a retry/fallback loop (repeated web-searching/retry behavior), causing long turns and unstable UX.

RAW_BUFFERClick to expand / collapse

Summary

When using Codex CLI through LiteLLM proxy, requests can appear to enter a retry/fallback loop (repeated web-searching/retry behavior), causing long turns and unstable UX.

What I observe

From session logs, behavior repeats in cycles:

  • repeated "Searching the web"
  • repeated "I will do X, then run tests" messages
  • occasional shell parsing errors from accidental plain-text command attempts
  • flow does not converge quickly and appears to loop before producing a stable result

In parallel, there are known Codex+LiteLLM transport issues that may amplify this behavior:

  • #24502 (GET /responses 405 mismatch)
  • #25532 (WS /v1/responses requiring ?model= leads to retries/fallback)

Environment

  • Codex CLI: 0.121.0
  • LiteLLM: proxy mode (version in my deployment may vary)
  • Transport: OpenAI-compatible endpoint via proxy

Why this may be proxy-related

When responses/websocket negotiation is not fully spec-compatible, Codex appears to retry/fallback multiple times per turn. In long tool-heavy sessions this feels like a loop.

Expected behavior

  • No repeated retry/fallback loops during normal turns
  • Stable completion after one transport selection (WS or HTTP fallback once)
  • Clear non-retriable error path when request shape is incompatible

Actual behavior

  • Multiple repeated retries/fallback-like cycles
  • Very long turns with repetitive actions/messages

Request

Please investigate whether current /responses (HTTP + WS) behavior with Codex CLI can cause repeated retry loops in practical sessions, and whether retry policy can be tightened for non-retriable mismatches.

If useful, I can provide sanitized full logs in comments.

extent analysis

TL;DR

Investigate and potentially tighten the retry policy for non-retriable mismatches in the Codex CLI with LiteLLM proxy to prevent repeated retry loops.

Guidance

  • Review the known transport issues (#24502 and #25532) and their potential impact on the retry/fallback behavior, as they may be amplifying the problem.
  • Verify if the LiteLLM proxy version is compatible with the Codex CLI version (0.121.0) and if any updates are available for the proxy.
  • Check the session logs for patterns in the retry loops, such as specific error messages or request shapes, to identify potential triggers for the retries.
  • Consider providing sanitized full logs for further investigation, as requested.

Example

No code snippet is provided due to the lack of specific code-related information in the issue.

Notes

The issue seems to be related to the interaction between the Codex CLI and the LiteLLM proxy, and resolving the known transport issues may help mitigate the problem. However, without more information about the specific configurations and versions used, it's difficult to provide a more detailed solution.

Recommendation

Apply workaround: Tighten the retry policy for non-retriable mismatches to prevent repeated retry loops, as this may help stabilize the behavior and reduce the occurrence of long turns with repetitive actions/messages.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • No repeated retry/fallback loops during normal turns
  • Stable completion after one transport selection (WS or HTTP fallback once)
  • Clear non-retriable error path when request shape is incompatible

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - 💡(How to fix) Fix [Bug]: Codex CLI via LiteLLM proxy appears to enter retry/fallback loop in real sessions [1 comments, 1 participants]