Skip to content

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) #34109

Open

Description

@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 -mprs → Linux 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.

Activity

  1. added
    bug
    extension
    app-server
    on Jul 19, 2026
  2. Suhaibinator commented on Jul 19, 2026

    @Suhaibinator
    Author

    Related issues (same extension version 26.715.31925 / Linux, overlapping symptoms):

    What is distinct about this issue: the explicit [IpcRouterManager] Unable to secure IPC socket errorMessage="Codex IPC socket is not owned by the current user" error (with connection-closed on the preceding Initialize) triggered by multiple windows of the same single user racing over ~/.codex/ipc/ipc.sock. Neither #34103 nor #34096 reports that specific ownership-check failure, so this appears to be a separate (though co-occurring) failure mode in the IpcRouterManager socket-ownership handling rather than a duplicate. Filing this note so maintainers can triage the three together.

  3. sidewaysdesign commented on Sep 18, 2026

    @sidewaysdesign

    Additional reproducible trigger for this multi-window startup problem:

    After VS Code installs an update and restarts, it restores all project/workspace windows that were open before the update. When several windows reopen at roughly the same time, Codex frequently fails to initialize in some of them and shows:

    Codex could not start

    There is no visible Retry/Restart action in that failed state.

    A reliable recovery is Command Palette → Developer: Reload Window on each affected window; Codex then starts normally without having to close and reopen the project window.

    This makes the failure look consistent with a startup race/timeout when multiple Codex extension instances initialize concurrently (IPC/app-server/auth/webview startup), although the exact subsystem has not been isolated.

    It may also be worth adding a Retry action to the “Codex could not start” UI so a transient initialization failure does not require a full VS Code window reload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app-serverbugextension

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions