IDE Extension: "Codex IPC socket is not owned by the current user" with multiple VS Code windows breaks the Codex panel (TOCTOU in socket ownership check)

Open 💬 1 comment Opened Jul 19, 2026 by Suhaibinator

What version of the IDE extension are you using?

openai.chatgpt-26.715.31925 (linux-x64)

What subscription do you have?

Pro

Which IDE are you using?

VS Code 1.129.1

What platform is your computer?

uname -mprsLinux 7.0.0-28-generic x86_64 x86_64

OS: Ubuntu 24.04.4 LTS (Linux kernel 7.0.0-28-generic, x86_64).

What issue are you seeing?

When more than one VS Code window is open, the Codex extension fails its own IPC socket ownership security check and the Codex panel breaks in the non-"router" windows.

The extension coordinates a single shared codex app-server across windows via a Unix domain socket router at ~/.codex/ipc/ipc.sock, electing one window as "the router". With two or more windows open, the windows race over that socket and the losing instances throw Codex IPC socket is not owned by the current user even though the socket is correctly owned by the current user. This looks like a TOCTOU race in the ownership verification: the socket passes the ownership check at one point but the Server listening handler then reports it as not owned. The IPC connection is closed and that window's Codex webview can no longer reach its backend.

Observed log sequence (Codex output channel):

[info] Activating Codex extension
[info] [CodexMcpConnection] Spawning codex app-server
[info] [IpcRouter] I am the router
[info] [CodexMcpConnection] Initialize received id=1
... (second window activates) ...
[info] Activating Codex extension
[info] [CodexMcpConnection] Spawning codex app-server
[info] [CodexMcpConnection] Initialize received id=1
[warning] [IpcClient] Initialize failed errorMessage=connection-closed errorName=Error errorStack="Error: connection-closed\n\tat Socket.<anonymous> (/home/<user>/.vscode/extensions/openai.chatgpt-26.715.31925-linux-x64/out/extension.js:548:18540)\n\tat Socket.emit (node:events:509:28)\n\tat Pipe.<anonymous> (node:net:351:12)"
[error] [IpcRouterManager] Unable to secure IPC socket errorMessage="Codex IPC socket is not owned by the current user" errorName=Error errorStack="Error: Codex IPC socket is not owned by the current user\n\tat ode (/home/<user>/.vscode/extensions/openai.chatgpt-26.715.31925-linux-x64/out/extension.js:548:6959)\n\tat Server.<anonymous> (/home/<user>/.vscode/extensions/openai.chatgpt-26.715.31925-linux-x64/out/extension.js:548:15025)\n\tat Object.onceWrapper (node:events:630:28)\n\tat Server.emit (node:events:509:28)\n\tat emitListeningNT (node:net:2052:10)\n\tat process.processTicksAndRejections (node:internal/process/task_queues:89:21)"

Investigation findings:

  • The socket ~/.codex/ipc/ipc.sock is owned by the current user (verified with find ... -printf '%u:%g') and is actively listened on by exactly one VS Code extension-host process (verified with ss -xlp, which showed a single code process holding it). The ownership check fails despite the socket being correctly owned by the current user.
  • With N windows open there were N codex app-server processes running (verified with ps), all owned by the current user, indicating each window spawns its own server rather than sharing one.
  • No remote/dev-container was involved (no remote authority); all processes ran as the same local UID, so this is not a container UID-mapping issue.

What steps can reproduce the bug?

  1. Install the Codex / ChatGPT VS Code extension on Linux.
  2. Open two or more VS Code windows (separate folders) with the extension active in each.
  3. Watch the Codex output channel in the second/third window: Initialize failed ... connection-closed followed by [IpcRouterManager] Unable to secure IPC socket ... Codex IPC socket is not owned by the current user. The Codex panel in that window is blank/non-functional.

Reproduced with 2–3 windows open simultaneously.

What is the expected behavior?

Additional windows should attach to the existing shared app-server via the router socket without failing the ownership check. The ownership verification should not misfire when the socket is legitimately owned by the current user. The Codex panel should work in all open windows.

Additional information

Downstream, user-visible symptoms in the affected window:

  • Repeated "Activating Codex extension" cycles.
  • The Codex sidebar webview panel renders blank.
  • Webview DevTools shows the panel's code-split chunk requests split between 200 (ServiceWorker) and (failed) net::ERR_FAILED, consistent with the webview frame being torn down mid-load each time the IPC connection drops.
  • A Could not register service worker: InvalidStateError was also seen earlier for the webview, consistent with repeated frame teardown.

Workaround: Quit all VS Code windows, kill leftover codex app-server processes, delete ~/.codex/ipc/ipc.sock, and reopen a single window (this establishes one clean router). The failure recurs as soon as multiple windows are reopened.

Related issues (same IpcRouterManager socket-ownership area, different failure mode): #22966, #27650, #24680 report EACCES when the shared /tmp/codex-ipc directory is owned by a different Unix user on a multi-user host. Those appear to have prompted moving the socket to the per-user ~/.codex/ipc/ path (as requested in #27650). This report is the complementary failure introduced around that ownership handling: on a single user with multiple windows, the ownership check now misfires with "not owned by the current user" even though the socket is correctly owned — so it is not a duplicate of the multi-user EACCES reports.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗