Skip to content

Name the display variables for the tool server Codex starts on Linux - #16

Open
anessbelbati wants to merge 1 commit into
Openpod:mainfrom
anessbelbati:fix/codex-linux-display
Open

anessbelbati wants to merge 1 commit into
Openpod:mainfrom
anessbelbati:fix/codex-linux-display

Conversation

@anessbelbati

Copy link
Copy Markdown

What problem does this fix, and what changes for the user?

On Linux, Codex gets none of the Video FS tools. Codex starts an MCP server with a short fixed list of environment variables (DEFAULT_ENV_VARS), and DISPLAY isn't on it. The video-fs server is the desktop app itself, and without a display it exits at startup (Missing X server or $DISPLAY), so Codex reports it failed to start and the model gets none of its tools.

On Linux the Codex entry now names the display variables to pass on (env_vars is the key Codex reads for that):

env_vars = ["DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "XDG_RUNTIME_DIR", "XDG_SESSION_TYPE"]

Nothing changes on macOS or Windows.

How was it tested?

Real Codex against a stand-in model server on a Linux runner, in a project prepared by setupAgentProject:

.codex/config.toml video-fs in Codex tools in the model request
as this branch writes it ready 13, one of them mcp__video_fs
the env_vars line taken out failed to start 12, none from the app

The same with Codex 0.160.1 on Oct 7 and 0.162.0 on Oct 9 (run: https://github.com/anessbelbati/impractical-video/actions/runs/37915846873). The launcher test now checks the line is written on Linux and nowhere else.

CI (verify), unchanged, passes on this branch on today's main: https://github.com/anessbelbati/impractical-video/actions/runs/38231937746

Any remaining limitations or migration steps?

  • Only X11 was tried (xvfb on the runner). The Wayland names are there so a Wayland session can reach its compositor the same way; not measured.
  • Setup never rewrites an existing .codex/config.toml, so an existing Linux project needs the line added by hand, or the file deleted and the project opened again.
  • This doesn't make the context hook run under Codex; that's Keep Claude's MCP approval keys out of the Codex hooks file #15.

Codex starts an MCP server with a fixed short list of environment variables
(HOME, PATH, LANG and a few more), not with its own environment. On Linux
the launcher in .codex/config.toml is the desktop app itself, and without
DISPLAY it exits at startup:

    Missing X server or $DISPLAY
    The platform failed to initialize.  Exiting.

Codex then logs "MCP server startup failed" for video-fs and offers the
model none of its tools. Measured with Codex 0.160.1 on ubuntu-latest
against a stand-in model server: none of the app's tools in the model
request with the entry as it was written before, the video-fs tools in the
request with this change. Started by hand with only the variables Codex
passes, the launcher ended after 1.2 s without answering; with the display
variables added it answered the MCP initialize request.

The entry now lists the display variables under env_vars, the key Codex
reads for variables to pass through from its own environment. Only an X11
display could be tried on the runner. The Wayland names are there so that
a Wayland session can reach its compositor the same way. Claude Code needed
no change: on the same runner it offered the video-fs tools already. What
is written on macOS and Windows does not change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant