codex - 💡(How to fix) Fix Codex Desktop SSH remote can tunnel to another user's app-server when remote port 9234 is already in use [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19590Fetched 2026-04-26 05:14:17
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×3closed ×1commented ×1

Codex Desktop's managed SSH remote connection can connect to a different user's already-running codex app-server on a shared remote host.

The SSH login itself is correct, but the Desktop app starts the remote app-server on fixed remote port 127.0.0.1:9234. If another user already owns that port, the new app-server startup fails with Address in use, while the SSH tunnel still forwards to 127.0.0.1:9234. The Desktop app then talks to the other user's app-server and displays that user's Codex home/config state.

Error Message

Error: Address in use (os error 98)

Root Cause

  1. User B's app-server fails to bind because the port is already in use.
RAW_BUFFERClick to expand / collapse

Summary

Codex Desktop's managed SSH remote connection can connect to a different user's already-running codex app-server on a shared remote host.

The SSH login itself is correct, but the Desktop app starts the remote app-server on fixed remote port 127.0.0.1:9234. If another user already owns that port, the new app-server startup fails with Address in use, while the SSH tunnel still forwards to 127.0.0.1:9234. The Desktop app then talks to the other user's app-server and displays that user's Codex home/config state.

Impact

This can expose or operate on the wrong user's remote Codex app-server state on shared systems.

In the observed case, the Desktop configuration screen offered to import external agent config from another user's home directory. The SSH target was the intended account, but the app-server behind the tunnel reported a different user's Codex home.

Reproduction Outline

  1. On a shared remote Linux host, have user A already running: codex app-server --listen ws://127.0.0.1:9234

  2. From Codex Desktop, create/connect a managed SSH remote as user B to the same host.

  3. Codex Desktop runs a remote bootstrap command equivalent to: nohup codex app-server --listen ws://127.0.0.1:9234 >/tmp/codex-app-server-ssh-ws-v0.log 2>&1 &

  4. User B's app-server fails to bind because the port is already in use.

  5. Codex Desktop still creates a local SSH tunnel to remote 127.0.0.1:9234.

  6. Desktop RPC calls then reach user A's app-server, not user B's.

Observed Evidence

  • Direct SSH to the remote reports the expected user and home directory.
  • Remote 127.0.0.1:9234 is already listening and owned by a different user.
  • The remote bootstrap log contains: Error: Address in use (os error 98)
  • The app-server reached through the Desktop SSH tunnel reports the other user's codexHome.
  • The Desktop configuration screen shows external-agent import paths under the other user's home directory.

Expected Behavior

Codex Desktop should never silently connect to an app-server owned by a different remote user.

At minimum, it should detect that the remote app-server failed to bind and fail the connection instead of tunneling to the occupied port.

Preferably, managed SSH remotes should use a per-user or otherwise collision-resistant remote app-server port/socket, or verify after connection that the app-server identity/home matches the SSH login.

Notes

The issue appears to be caused by the managed SSH transport using fixed remote port 9234 for the app-server and not validating that the process behind the tunnel was the one just started for the current SSH user.

extent analysis

TL;DR

Use a per-user remote app-server port to prevent collisions and ensure the correct user's app-server is connected.

Guidance

  • Identify the current port usage on the shared remote host to understand the scope of the issue.
  • Consider implementing a dynamic port allocation system for the app-server to avoid fixed port collisions.
  • Modify the Codex Desktop managed SSH remote connection to validate the app-server identity and home directory after connection to ensure it matches the SSH login user.
  • As a temporary workaround, manually specify a unique port for each user's app-server when starting it remotely.

Example

No code snippet is provided as the issue does not imply a specific code change but rather a design or configuration adjustment.

Notes

The solution requires changes to how Codex Desktop manages SSH connections and app-server ports. This might involve significant updates to the application's logic for handling remote connections and port allocation.

Recommendation

Apply a workaround by using dynamic port allocation or manually specifying unique ports for each user's app-server until a permanent fix can be implemented in the Codex Desktop application. This approach ensures that each user's app-server can run without port collisions and that the correct app-server is connected through the SSH tunnel.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING