openai / openai/codex

Codex hangs on “thinking” or “web search” while WebSocket retries time out

Open
#43,183 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug CLI connectivity windows-os
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What version of Codex CLI is running?

codex-cli 0.153.4

What subscription do you have?

ChatGPT Pro 20x

Which model were you using?

gpt-6-astra (high reasoning, Fast mode); also reproduced with gpt-daybreak-blue-latest

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What terminal emulator and version are you using (if applicable)?

Windows Terminal / PowerShell 7.6.5

Codex doctor report
PS C:\WINDOWS\system32> codex doctor --json
{
  "schemaVersion": 1,
  "generatedAt": "1788682297s since unix epoch",
  "overallStatus": "warning",
  "codexVersion": "0.153.4",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "C:\\Users\\Tama\\.codex\\app-server-control\\app-server-control.sock",
        "daemon state dir": "C:\\Users\\Tama\\.codex\\app-server-daemon",
        "mode": "ephemeral",
        "pid file": "C:\\Users\\Tama\\.codex\\app-server-daemon\\app-server.pid (missing)",
        "settings": "C:\\Users\\Tama\\.codex\\app-server-daemon\\settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "C:\\Users\\Tama\\.codex\\app-server-daemon\\app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 0
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "auth is configured",
      "details": {
        "auth file": "C:\\Users\\Tama\\.codex\\auth.json",
        "auth storage mode": "File",
        "stored API key": "false",
        "stored ChatGPT tokens": "true",
        "stored agent identity": "false",
        "stored auth mode": "chatgpt"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "C:\\Users\\Tama\\.codex",
        "config.toml": "C:\\Users\\Tama\\.codex\\config.toml",
        "config.toml parse": "ok",
        "cwd": "C:\\WINDOWS\\system32",
        "enabled feature flags": "<redacted>",
        "feature flag overrides": "none",
        "feature flags enabled": "48",
        "log dir": "C:\\Users\\Tama\\.codex\\log",
        "mcp servers": "1",
        "model": "gpt-daybreak-blue-latest",
        "model provider": "openai",
        "sqlite home": "C:\\Users\\Tama\\.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "desktop.app.version": {
      "id": "desktop.app.version",
      "category": "desktop",
      "status": "ok",
      "summary": "the desktop application is installed",
      "details": {
        "log directory": "$HOME\\AppData\\Local\\Codex/Logs",
        "running": "false",
        "version": "26.901.6511.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "desktop.app_server.handshake": {
      "id": "desktop.app_server.handshake",
      "category": "desktop",
      "status": "ok",
      "summary": "the desktop application is not running",
      "details": {},
      "remediation": null,
      "durationMs": 0
    },
    "desktop.security.enforcement": {
      "id": "desktop.security.enforcement",
      "category": "desktop",
      "status": "ok",
      "summary": "no locally visible recent Codex security enforcement was found",
      "details": {},
      "remediation": null,
      "durationMs": 0
    },
    "git.environment": {
      "id": "git.environment",
      "category": "git",
      "status": "ok",
      "summary": "git version 2.55.0.windows.5",
      "details": {
        "PATH git #1": "C:\\Program Files\\Git\\cmd\\git.exe",
        "PATH git entries": "1",
        "git build options": "git version 2.55.0.windows.5; cpu: x86_64; built from commit: 32c4f7689275d233577576630e1ac5b7eb354eb0; sizeof-long: 4; sizeof-size_t: 8; shell-path: D:/git-sdk-64-build-installers/usr/bin/sh; rust: disabled; feature: fsmonitor--daemon; gettext: enabled; libcurl: 8.21.0; OpenSSL: OpenSSL 3.5.7 9 Jun 2026; zlib: 1.3.2; SHA-1: SHA1_DC; SHA-256: SHA256_BLK; default-ref-format: files; default-hash: sha1",
        "git exec path": "C:/Program Files/Git/mingw64/libexec/git-core",
        "git version": "git version 2.55.0.windows.5",
        "repo detected": "false",
        "selected git": "C:\\Program Files\\Git\\cmd\\git.exe"
      },
      "remediation": null,
      "durationMs": 62
    },
    "git.worktree.dev_drive": {
      "id": "git.worktree.dev_drive",
      "category": "git",
      "status": "ok",
      "summary": "no Git worktree is active",
      "details": {},
      "remediation": null,
      "durationMs": 0
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "C:\\Users\\Tama\\AppData\\Local\\Programs\\OpenAI\\Codex\\bin\\codex.exe",
        "current executable": "C:\\Users\\Tama\\AppData\\Local\\Programs\\OpenAI\\Codex\\bin\\codex.exe",
        "install context": "standalone (windows, package C:\\Users\\Tama\\.codex\\packages\\standalone\\releases\\0.153.4-x86_64-pc-windows-msvc, bin C:\\Users\\Tama\\.codex\\packages\\standalone\\releases\\0.153.4-x86_64-pc-windows-msvc\\bin, resources C:\\Users\\Tama\\.codex\\packages\\standalone\\releases\\0.153.4-x86_64-pc-windows-msvc\\codex-resources, path C:\\Users\\Tama\\.codex\\packages\\standalone\\releases\\0.153.4-x86_64-pc-windows-msvc\\codex-path)",
        "managed by Vite+": "false",
        "managed by bun": "false",
        "managed by npm": "false",
        "managed by pnpm": "false",
        "managed package root": "not set"
      },
      "remediation": null,
      "durationMs": 29
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "MCP configuration is locally consistent",
      "details": {
        "configured servers": "1",
        "disabled servers": "0",
        "stdio servers": "1"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "managed proxy": "not configured",
        "proxy env vars": "none",
        "respect system proxy": "disabled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "ChatGPT inference URL": "https://chatgpt.com/backend-api/<redacted> reachable (HTTP 405)",
        "desktop assets CDN": "https://persistent.oaistatic.com/codex-app-prod/<redacted> reachable (HTTP 200)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": null,
      "durationMs": 158
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket handshake succeeded",
      "details": {
        "DNS": "2 IPv4, 2 IPv6, first IPv6",
        "auth mode": "chatgpt",
        "connect timeout": "15000 ms",
        "endpoint": "wss://chatgpt.com/backend-api/<redacted>",
        "handshake result": "HTTP 101 Switching Protocols",
        "model provider": "openai",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "reasoning header": "false",
        "server model present": "false",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 697
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running standalone on windows-x86_64",
      "details": {
        "commit": "unknown",
        "current executable": "C:\\Users\\Tama\\AppData\\Local\\Programs\\OpenAI\\Codex\\bin\\codex.exe",
        "install method": "standalone (windows, package C:\\Users\\Tama\\.codex\\packages\\standalone\\releases\\0.153.4-x86_64-pc-windows-msvc, bin C:\\Users\\Tama\\.codex\\packages\\standalone\\releases\\0.153.4-x86_64-pc-windows-msvc\\bin, resources C:\\Users\\Tama\\.codex\\packages\\standalone\\releases\\0.153.4-x86_64-pc-windows-msvc\\codex-resources, path C:\\Users\\Tama\\.codex\\packages\\standalone\\releases\\0.153.4-x86_64-pc-windows-msvc\\codex-path)",
        "platform": "windows-x86_64",
        "version": "0.153.4"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (bundled)",
      "details": {
        "search command": "C:\\Users\\Tama\\.codex\\packages\\standalone\\releases\\0.153.4-x86_64-pc-windows-msvc\\codex-path\\rg.exe",
        "search command readiness": "file exists",
        "search provider": "bundled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "OnRequest",
        "codex-linux-sandbox helper": "none",
        "denied-read restrictions": "false",
        "execve wrapper helper": "none",
        "filesystem sandbox": "restricted",
        "network sandbox": "restricted",
        "sandbox backend": "elevated",
        "sandbox provisioning": "complete"
      },
      "remediation": null,
      "durationMs": 2
    },
    "security.endpoint": {
      "id": "security.endpoint",
      "category": "security",
      "status": "warning",
      "summary": "endpoint protection detected; Codex exclusions are unverified",
      "details": {
        "Codex exclusions": "not verified",
        "endpoint products": "Microsoft Defender",
        "exclusion targets": "signed Codex app; codex.exe; codex-windows-sandbox-setup.exe; codex-command-runner.exe; codex-code-mode-host.exe"
      },
      "issues": [
        {
          "severity": "warning",
          "cause": "Microsoft Defender can interfere with Codex. Verify Codex exclusions.",
          "measured": "not verified",
          "expected": "Codex application and helper exclusions",
          "remedy": "Microsoft Defender: Add a certificate or executable-path exclusion for Codex and its helpers. If Attack Surface Reduction blocks Codex, add a rule exclusion. If Controlled Folder Access blocks Codex, allow the app.",
          "fields": [
            "Codex exclusions"
          ]
        }
      ],
      "remediation": "ask your security administrator to verify Codex exclusions and required helper allowances",
      "durationMs": 13
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",
      "details": {
        "CODEX_HOME": "C:\\Users\\Tama\\.codex (dir)",
        "active rollout files": "24 files, 102774261 total bytes, 4282260 average bytes",
        "archived rollout files": "12 files, 10304749 total bytes, 858729 average bytes",
        "goals DB": "C:\\Users\\Tama\\.codex\\goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "C:\\Users\\Tama\\.codex\\logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "C:\\Users\\Tama\\.codex\\log (missing)",
        "memories DB": "C:\\Users\\Tama\\.codex\\memories_1.sqlite (file)",
        "memories DB integrity": "ok",
        "queue DB": "C:\\Users\\Tama\\.codex\\queue_1.sqlite (file)",
        "queue DB integrity": "ok",
        "sqlite home": "C:\\Users\\Tama\\.codex (dir)",
        "standalone release cache": "5 entries in C:\\Users\\Tama\\.codex\\packages\\standalone\\releases",
        "state DB": "C:\\Users\\Tama\\.codex\\state_5.sqlite (file)",
        "state DB integrity": "ok",
        "thread history DB": "C:\\Users\\Tama\\.codex\\thread_history_1.sqlite (file)",
        "thread history DB integrity": "ok"
      },
      "remediation": null,
      "durationMs": 125
    },
    "state.rollout_db_parity": {
      "id": "state.rollout_db_parity",
      "category": "threads",
      "status": "ok",
      "summary": "rollout files and state DB thread inventory agree",
      "details": {
        "default model provider": "openai",
        "rollout DB active files": "24",
        "rollout DB active rows": "24",
        "rollout DB archive mismatches": "0",
        "rollout DB archived files": "12",
        "rollout DB archived rows": "12",
        "rollout DB duplicate DB paths": "0",
        "rollout DB duplicate rollout thread ids": "0",
        "rollout DB malformed file names": "0",
        "rollout DB missing active rows": "0",
        "rollout DB missing archived rows": "0",
        "rollout DB model providers": "openai=36",
        "rollout DB rows": "36",
        "rollout DB scan cap reached": "false",
        "rollout DB scan errors": "0",
        "rollout DB sources": "subagent:thread_spawn=13, cli=10, subagent:other=7, vscode=6",
        "rollout DB stale rows": "0"
      },
      "remediation": null,
      "durationMs": 50
    },
    "system.disk": {
      "id": "system.disk",
      "category": "disk",
      "status": "ok",
      "summary": "sufficient free disk space (748.5 GiB)",
      "details": {
        "CODEX_HOME available": "748.5 GiB",
        "failure threshold": "1.0 GiB",
        "warning threshold": "5.0 GiB",
        "worktree available": "748.5 GiB"
      },
      "remediation": null,
      "durationMs": 0
    },
    "system.environment": {
      "id": "system.environment",
      "category": "system",
      "status": "ok",
      "summary": "OS language en-US",
      "details": {
        "EDITOR": "not set",
        "VISUAL": "not set",
        "os": "Windows 10.0.26200 (Windows 11 Core) [64-bit]",
        "os language": "en-US",
        "os type": "Windows",
        "os version": "10.0.26200"
      },
      "remediation": null,
      "durationMs": 0
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "color output": "enabled",
        "console input code page": "437",
        "console output code page": "437",
        "stderr console mode": "0x00000007 (VT processing: true)",
        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout console mode": "0x00000007 (VT processing: true)",
        "stdout is terminal": "true",
        "terminal": "unknown",
        "terminal size": "120x30"
      },
      "remediation": null,
      "durationMs": 0
    },
    "terminal.title": {
      "id": "terminal.title",
      "category": "title",
      "status": "ok",
      "summary": "terminal title default",
      "details": {
        "terminal title activity": "true",
        "terminal title items": "activity, project-name",
        "terminal title project source": "cwd",
        "terminal title project value": "system32",
        "terminal title source": "default"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.153.4",
        "check for update on startup": "true",
        "last checked at": "2026-09-05T15:57:28.482855100Z",
        "latest version": "0.153.4",
        "latest version status": "current version is not older",
        "update action": "standalone installer",
        "version cache": "C:\\Users\\Tama\\.codex\\version.json"
      },
      "remediation": null,
      "durationMs": 365
    }
  }
}
PS C:\WINDOWS\system32>
What issue are you seeing?
What happened?

For the past couple of days, Codex has been randomly getting stuck during tasks. This happens in both the CLI and the desktop app.

The UI usually remains on “thinking” or “web search,” but the web request itself is not stuck. In the sessions I checked, the tool call completed successfully and Codex stopped responding while trying to continue afterward.

The logs show this error:

stream disconnected before completion: idle timeout waiting for websocket

Codex then retries up to five times, with each attempt taking roughly five minutes. From the UI, this looks like the task is thinking indefinitely.

I have also seen:

WebSocket protocol error: Connection reset without closing handshake

It is not limited to web search. “Web search” is often just the last completed action shown in the UI.

Example

One desktop task stalled immediately after a completed web request. The retry log entries occurred at:

  • 2026-09-06 07:51:45 UTC — retry 1/5
  • 2026-09-06 07:57:17 UTC — retry 2/5
  • 2026-09-06 08:02:50 UTC — retry 3/5

The WebSocket handshake succeeded on fresh connections, but no response events arrived before the idle timeout.

Checks already performed
  • Authentication and configuration validate successfully.
  • Usage and context limits were not exhausted.
  • No proxy is configured.
  • The Codex database passes its integrity check.
  • No Defender blocks or matching Windows network-disconnect events were found.
  • WebSocket handshakes succeed, including on fresh retry connections.
  • The same transport errors occur across different models and in both clients.

The common failure appears to be the Responses WebSocket continuation after a tool call, rather than the tool or web search itself.

What steps can reproduce the bug?

This is intermittent, but it happens most often during longer tasks that use several tools:

  1. Start a task in either Codex CLI or the desktop app.
  2. Let it run through several tool calls or web searches.
  3. After a tool finishes, Codex sometimes never continues.
  4. The last activity marker remains visible while the logs show WebSocket timeouts and retries.
What is the expected behavior?

Codex should continue after the tool result. If the response connection fails, it should recover promptly or display an error instead of silently retrying for 25 minutes or longer.

Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the hang on Windows with Codex CLI 0.153.4 and run the provided codex doctor --json report. Inspect the active rollout files and SQLite logs under C:\Users\Tama\.codex, focusing on network.websocket_reachability and WebSocket retry behavior. Done means thinking or web-search requests complete without repeated WebSocket timeouts.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.