Skip to content

Codex CLI sessions become unrecoverable after ~37-40 minutes on Windows 11 after websocket disconnects #18723

@kfawell

Description

@kfawell

Title: Codex CLI sessions become unrecoverable after ~37-40 minutes on Windows 11 after websocket disconnects

What version of Codex CLI is running?

codex-cli 0.121.0

Which model were you using?

gpt-5.4

What platform is your computer?

Windows 11

What terminal emulator are you using?

PowerShell

Network environment

Home network, no intentional VPN/proxy in use.

What issue are you seeing?

In Codex CLI, a session works normally for a while, then starts failing with websocket disconnect/reconnect behavior. Once a given session enters this state, it no longer recovers. Opening a brand new session works again temporarily, but after roughly the same amount of time, that new session also starts failing.

The affected session is not just interrupted mid-turn once; it becomes effectively poisoned:

  • re-opening the same session is possible
  • but as soon as I send another prompt, it spends a long time trying to connect/reconnect
  • it does not resume normal operation
  • starting a fresh session is the only workaround

User-visible error

Stream disconnected before completion: failed to send websocket request: IO error: An existing connection was forcibly closed by the remote host. (os error 10054)

What steps can reproduce the bug?

  1. Start a new Codex CLI session on Windows 11.
  2. Use the session normally for around 30-40 minutes.
  3. Continue sending prompts after that point.
  4. Eventually the session starts hitting websocket disconnect/retry behavior.
  5. After that happens, the same session no longer recovers; any new prompt in that session triggers long reconnect attempts.
  6. Start a fresh session.
  7. The fresh session works again, but later fails the same way.

What is the expected behavior?

If a websocket transport drops mid-session, the session should either:

  • reconnect cleanly and continue working, or
  • fail once for that turn but remain usable for future prompts.

A session should not become permanently unusable after one of these disconnects.

What do you see instead?

The session retries repeatedly and then remains stuck in a reconnect/failure loop. A new session works, but the old session appears permanently unrecoverable.

Timing observed locally

I checked the local session metadata and codex-tui.log timestamps. Two recent CLI sessions on the same machine showed:

  • Session A:

    • started: 2026-04-19T20:38:04.277Z
    • first disconnect: 2026-04-19T21:18:06.307Z
    • elapsed: about 40m 02s
  • Session B:

    • started: 2026-04-20T18:52:37.394Z
    • first disconnect: 2026-04-20T19:29:51.868Z
    • elapsed: about 37m 14s

So the first failure appears after roughly 37-40 minutes in recent sessions.

Relevant sanitized log excerpts

2026-04-19T21:18:06.307294Z  WARN ... thread.id=<redacted> ... codex_core::codex:
stream disconnected - retrying sampling request (1/5 in 213ms)...

2026-04-19T21:29:44.689782Z  INFO ... thread.id=<redacted> ... codex_core::codex:
Turn error: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses)
2026-04-20T19:29:51.868205Z  WARN ... thread.id=<redacted> ... codex_core::codex:
stream disconnected - retrying sampling request (1/5 in 208ms)...

2026-04-20T19:31:35.011644Z  WARN ... thread.id=<redacted> ... codex_core::client:
falling back to HTTP

2026-04-20T19:33:13.257185Z  WARN ... thread.id=<redacted> ... codex_core::codex:
stream disconnected - retrying sampling request (1/5 in 196ms)...

Additional notes

This does not look like a one-off total network outage because:

  • new sessions can still be started after the failure
  • those new sessions work normally for a while
  • the problem is that older affected sessions do not recover once they start disconnecting

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconnectivityIssues involving networking or endpoint connectivity problems (disconnections)sessionIssues involving session (thread) management, resuming, forking, naming, archivingwindows-osIssues related to Codex on Windows systems

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions