Skip to content

Codex VS Code extension hangs when VS Code is launched via /usr/share/code/code, but works via /usr/bin/code #34765

Description

@ilnblue

What version of the IDE extension are you using?

26.715.61943

What subscription do you have?

ChatGPT Plus

Which IDE are you using?

VS Code

What platform is your computer?

No response

What issue are you seeing?

The Codex VS Code extension hangs indefinitely on its loading logo when VS Code is launched from the Linux desktop application menu.

I isolated the problem to the VS Code launch path:

  • Launching VS Code with /usr/share/code/code /path/to/workspace reproduces the issue.
  • Launching the same VS Code installation with /usr/bin/code /path/to/workspace works correctly.
  • Running /usr/bin/code with the same restricted PATH used by the desktop session also works, so this does not appear to be caused by PATH, Node.js, NVM, or other shell environment variables.
  • The same Codex extension version, user-data directory, extensions, workspace, and authentication are used in both cases.

During a failed launch, the Codex log stops after:

[CodexMcpConnection] Initialize received id=1

During a successful launch, it continues with messages such as:

React root render requested
app routes mounted
ready provider mounted

The workaround is to create a user-level desktop entry at:

~/.local/share/applications/code.desktop

and change its Exec entries from:

Exec=/usr/share/code/code %F

to:

Exec=/usr/bin/code %F

After updating the desktop database and launching VS Code through the modified desktop entry, the Codex extension loads normally across repeated launches.

This appears to be a difference between launching VS Code directly through the Electron binary and launching it through the VS Code CLI wrapper.

What steps can reproduce the bug?

  1. Install Visual Studio Code and the OpenAI Codex extension on Linux.

  2. Confirm that the system desktop entry launches VS Code directly. For example:

    grep '^Exec=' /usr/share/applications/code.desktop

    The result includes:

    Exec=/usr/share/code/code %F

  3. Completely close all VS Code windows and confirm that no VS Code processes remain.

  4. Launch VS Code from the desktop application menu or pinned dock icon.

  5. Open the Codex sidebar.

  6. Observe that the Codex extension remains indefinitely on the loading logo. Its log stops after:

    [CodexMcpConnection] Initialize received id=1

  7. Completely close VS Code again.

  8. Launch the same installation, workspace, user-data, extensions, and Codex account from a terminal:

    /usr/bin/code /path/to/workspace

  9. Open the Codex sidebar and observe that it loads normally. The log continues with:

    React root render requested
    app routes mounted
    ready provider mounted

  10. To reproduce the failing launch without using the desktop menu, completely close VS Code and run:

    /usr/share/code/code /path/to/workspace

    The Codex extension hangs on the loading logo again.

  11. As a workaround, copy the desktop entry to the user application directory and replace the executable:

    mkdir -p ~/.local/share/applications
    cp /usr/share/applications/code.desktop ~/.local/share/applications/code.desktop
    sed -i 's|Exec=/usr/share/code/code|Exec=/usr/bin/code|g' ~/.local/share/applications/code.desktop
    update-desktop-database ~/.local/share/applications

  12. Launch VS Code from the modified desktop entry. The Codex extension now loads normally across repeated launches.

What is the expected behavior?

No response

Additional information

No response

Activity

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

    bugSomething isn't workingextensionIssues related to the VS Code extension

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions