railway CLI adds Codex remote terminal and Desktop setup
Introduced 2026-09-10 · score 0.97
HOW TO USE IT
When setting up or reconnecting a Railway cloud agent for Codex, use `railway code --codex` with the documented creation, `connect`, or `desktop-only` form; retrieve saved details with `railway code get-config [<agent-name-or-id>]`. Desktop-only saves SSH and project configuration for Codex Desktop’s next startup and leaves the backend running.
railway code --codex --new
railway code --codex --agent <agent-name> --dir <remote-directory>
railway code --codex connect [<agent-name-or-id>]railway code --codex desktop-only --new
railway code --codex desktop-only --agent <agent-name> --dir <remote-directory>railway code get-config [<agent-name-or-id>]WHY THIS HELPS
Set up or reconnect a local Codex terminal or Desktop client to a persistent Railway cloud agent.
REQUIREMENTS AND LIMITATIONS
- Version: v5.52.0
- --codex (required): Select Codex setup or connection.
- --new: Create a fresh VM for the new agent setup.
- --agent <name-or-id>: Select an existing agent for setup; used instead of `--new`.
- --dir <remote-directory>: Select the remote project directory.
- connect [<agent-name-or-id>]: Reconnect to a running Codex server; without an argument, discover running servers.
- desktop-only: Run Desktop setup without prompting to install or launch a local terminal client.
- get-config <agent-name-or-id>: Select saved connection details by agent name or ID; omit to retrieve the most recently saved connection.
- --name <name>: Override the generated Codex agent name.
- Prerequisite: Install the Railway CLI and authenticate with `railway login`.
- Prerequisite: Codex server must support `--ws-auth` and `--ws-token-file`; terminal mode uses a local client matching the server version.
- Terminal setup carries available local Codex sign-in and configured skills/MCP sync.
- Terminal setup starts App Server on port 8080 and verifies its public WebSocket handshake.
- Desktop-only setup verifies the public endpoint, registers SSH, saves the remote project for Codex Desktop to import at its next startup, then exits while leaving the backend running.
- Desktop-only setup does not prompt to install or launch a local terminal client.
- Generated names are checked against existing names before creation; when using the default cloud agents project, the label comes from the local repository or directory instead of the project name.
- Reconnect migrates older default aliases while preserving custom settings.
- Tools, files, and threads live on the VM.
- Docs conflict: Current Railway CLI documentation describes newer behavior: Codex App Server defaults to a configured code port (default 4096) or legacy port 8080; the v5.52.0 README says port 8080. Used the version-tagged documentation.
FIRST-PARTY EVIDENCE
- https://github.com/railwayapp/cli/releases/tag/v5.52.0
- https://github.com/railwayapp/cli/pull/1188
- https://github.com/railwayapp/cli/blob/v5.52.0/README.md
Check the installed version and the source before using it. Entry JSON