codex - 💡(How to fix) Fix Long-lived ChatGPT-auth CLI sessions can stall on codex_apps while fresh sessions load instantly (403 Cloudflare HTML on connectors/apps discovery) [1 comments, 2 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
openai/codex#19284Fetched 2026-04-24 10:39:22
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×4commented ×1unlabeled ×1

I am seeing a session-age-dependent startup degradation on Codex CLI with ChatGPT login.

Fresh/lightweight sessions on the same machine/account/network initialize apps/MCP quickly, but long-lived sessions can stall for minutes showing:

Starting MCP servers (2/3): codex_apps

When that happens, local logs show apps/connectors discovery failing with 403 Forbidden and a Cloudflare challenge HTML page instead of JSON.

This does not appear to be a broken local install:

  • fresh sessions work immediately on the same machine/account/network
  • I upgraded to codex-cli 0.124.0 and re-ran codex logout / codex login
  • the problem still reproduces only on long-lived sessions

Root Cause

I am seeing a session-age-dependent startup degradation on Codex CLI with ChatGPT login.

Fresh/lightweight sessions on the same machine/account/network initialize apps/MCP quickly, but long-lived sessions can stall for minutes showing:

Starting MCP servers (2/3): codex_apps

When that happens, local logs show apps/connectors discovery failing with 403 Forbidden and a Cloudflare challenge HTML page instead of JSON.

This does not appear to be a broken local install:

  • fresh sessions work immediately on the same machine/account/network
  • I upgraded to codex-cli 0.124.0 and re-ran codex logout / codex login
  • the problem still reproduces only on long-lived sessions

Code Example

Starting MCP servers (2/3): codex_apps

---

failed to load full apps list; falling back to installed apps snapshot: Failed to load apps: Request failed with status 403 Forbidden: <html>

---

Enable JavaScript and cookies to continue

---

/backend-api//connectors/directory/list?external_logos=true
RAW_BUFFERClick to expand / collapse

Description

I am seeing a session-age-dependent startup degradation on Codex CLI with ChatGPT login.

Fresh/lightweight sessions on the same machine/account/network initialize apps/MCP quickly, but long-lived sessions can stall for minutes showing:

Starting MCP servers (2/3): codex_apps

When that happens, local logs show apps/connectors discovery failing with 403 Forbidden and a Cloudflare challenge HTML page instead of JSON.

This does not appear to be a broken local install:

  • fresh sessions work immediately on the same machine/account/network
  • I upgraded to codex-cli 0.124.0 and re-ran codex logout / codex login
  • the problem still reproduces only on long-lived sessions

Environment

  • Codex CLI: 0.124.0
  • Auth mode: ChatGPT login (not API key)
  • Platform: WSL2 Linux
  • Kernel: Linux KAI 6.6.87.2-microsoft-standard-WSL2 x86_64
  • Node: v24.12.0
  • npm: 11.13.0

What I observe

Fresh / lightweight session

  • starts normally
  • apps/connectors load essentially immediately

Long-lived session

  • can hang for minutes at Starting MCP servers (2/3): codex_apps
  • local logs show full apps list load failing and falling back
  • the failing response is Cloudflare challenge HTML from chatgpt.com/backend-api/..., not JSON

Representative local evidence:

failed to load full apps list; falling back to installed apps snapshot: Failed to load apps: Request failed with status 403 Forbidden: <html>

The returned HTML includes the Cloudflare challenge text:

Enable JavaScript and cookies to continue

One failing path I captured locally was:

/backend-api//connectors/directory/list?external_logos=true

I also observed the same general Cloudflare/403 symptom family discussed in other issues, but the important isolation detail here is that a fresh new CLI session works immediately while the older long-running session degrades into this state.

Steps to reproduce

I do not have a tiny deterministic repro yet, but this is the pattern I can reproduce repeatedly:

  1. Start Codex CLI using ChatGPT auth
  2. Keep using the same session for a long time (multiple hours / heavy ongoing work)
  3. At some point, apps-related startup/initialization paths begin hanging for minutes
  4. Open a fresh/lightweight new session on the same machine/account/network
  5. Observe that the fresh session initializes apps immediately

Expected behavior

If apps/connectors discovery is blocked or challenged, Codex CLI should fail open quickly (or skip that discovery path) instead of looking hung on codex_apps. Also, long-lived sessions should not degrade this way while fresh sessions on the same machine still work.

Related issues

This looks related to the broader Cloudflare challenge / app discovery family, especially:

  • #16543
  • #16341
  • #16618
  • #16808
  • #17860
  • #17880

But this report adds a specific repro pattern: session age matters. Fresh sessions succeed; older long-lived sessions are the ones that degrade.

extent analysis

TL;DR

The most likely fix is to implement a session renewal or refresh mechanism to prevent long-lived sessions from degrading due to Cloudflare challenges.

Guidance

  • Investigate the authentication token or session management in Codex CLI to determine if token expiration or renewal is possible.
  • Consider adding a periodic refresh or renewal of the authentication token to prevent session degradation.
  • Review the related issues (#16543, #16341, #16618, #16808, #17860, #17880) to see if any of the proposed solutions or workarounds can be applied to this specific use case.
  • Test the hypothesis that the issue is related to session age by intentionally renewing the session or authentication token after a certain period of inactivity.

Example

No code snippet is provided as the issue does not contain sufficient information about the Codex CLI's internal implementation.

Notes

The issue seems to be related to the Cloudflare challenge and app discovery, but the specific repro pattern of session age dependence adds a new layer of complexity. Further investigation into the authentication and session management mechanisms of Codex CLI is necessary to determine the root cause and develop a fix.

Recommendation

Apply a workaround by implementing a periodic session refresh or renewal mechanism to prevent long-lived sessions from degrading due to Cloudflare challenges. This approach may help mitigate the issue until a more permanent fix can be developed.

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

If apps/connectors discovery is blocked or challenged, Codex CLI should fail open quickly (or skip that discovery path) instead of looking hung on codex_apps. Also, long-lived sessions should not degrade this way while fresh sessions on the same machine still work.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Long-lived ChatGPT-auth CLI sessions can stall on codex_apps while fresh sessions load instantly (403 Cloudflare HTML on connectors/apps discovery) [1 comments, 2 participants]