codex - 💡(How to fix) Fix Codex App Remote SSH is slow and fragile behind NLB compared with VS Code Remote SSH [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#20128Fetched 2026-04-30 06:33:29
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×4commented ×1cross-referenced ×1

Error Message

Error: Address in use (os error 98)

Root Cause

In the same environment, VS Code Remote SSH usually reconnects quickly because it reuses its remote server. Codex App remote connections often spend much longer in setup/reconnect, and failures are surfaced as generic connection errors even when the underlying SSH host is otherwise reachable.

Code Example

ssh <alias> 'whoami && hostname && pwd'
# root
# <remote-hostname>
# /root

---

ssh <alias> 'command -v codex && codex --version && codex login status'
# /usr/local/bin/codex
# codex-cli 0.125.0
# Logged in using ChatGPT

---

kex_exchange_identification: read: Connection reset by peer
Connection reset by <gateway-ip> port <ssh-port>

---

kex_exchange_identification: banner line 0: Not allowed at this time
Connection reset by <gateway-ip> port <ssh-port>

---

Error: Address in use (os error 98)

---

127.0.0.1:9234
RAW_BUFFERClick to expand / collapse

What happened

Codex App remote SSH connections are noticeably slower and more fragile than VS Code Remote SSH when connecting to a Linux development machine through an SSH-accessible network load balancer / gateway.

In the same environment, VS Code Remote SSH usually reconnects quickly because it reuses its remote server. Codex App remote connections often spend much longer in setup/reconnect, and failures are surfaced as generic connection errors even when the underlying SSH host is otherwise reachable.

Environment

  • Codex App: macOS app com.openai.codex, version 26.422.71525
  • Local OS: macOS 26.4.1
  • Local OpenSSH: OpenSSH_10.2p1, LibreSSL 3.3.6
  • Remote OS: Ubuntu 22.04.5 LTS
  • Remote Codex CLI: codex-cli 0.125.0
  • Remote access: SSH host alias in ~/.ssh/config, using a concrete host alias and a non-standard SSH port behind a network load balancer / gateway
  • Remote host is reachable by normal ssh <alias> when the gateway is healthy

Symptoms observed

  1. Normal SSH can succeed quickly:
ssh <alias> 'whoami && hostname && pwd'
# root
# <remote-hostname>
# /root
  1. Remote Codex is installed and authenticated:
ssh <alias> 'command -v codex && codex --version && codex login status'
# /usr/local/bin/codex
# codex-cli 0.125.0
# Logged in using ChatGPT
  1. Codex App remote connection can still be slow or fail while VS Code Remote SSH feels much faster in the same setup.

  2. During failures, SSH sometimes fails before authentication with messages like:

kex_exchange_identification: read: Connection reset by peer
Connection reset by <gateway-ip> port <ssh-port>

or:

kex_exchange_identification: banner line 0: Not allowed at this time
Connection reset by <gateway-ip> port <ssh-port>

The gateway and machine can recover shortly afterward, but repeated Codex App reconnect attempts appear to make the experience worse.

  1. Separately, we also observed stale remote app-server state / fixed-port conflicts on the remote host:
Error: Address in use (os error 98)

with a remote process listening on:

127.0.0.1:9234

This appears related to the existing reports about the fixed remote app-server port and stale app-server/session behavior.

Expected behavior

Codex App remote SSH should feel closer to VS Code Remote SSH in reconnect behavior, or at least provide clearer diagnostics that distinguish:

  • SSH gateway / NLB reset before authentication
  • remote codex missing from PATH
  • remote authentication missing
  • stale codex app-server process
  • fixed port 127.0.0.1:9234 already in use
  • reconnecting to a stale/incorrect remote app-server

Ideally the app would reuse or clean up its remote app-server more robustly, avoid fixed-port collisions where possible, and show the exact failing layer instead of a generic connection failure.

Related issues

These look related but do not fully cover the observed performance/diagnostic angle behind an SSH gateway/NLB:

  • #18503
  • #18547
  • #19300
  • #10450

Notes

The SSH config uses a concrete host alias, not a Host * pattern, consistent with the remote connections docs. remote_connections = true is enabled in ~/.codex/config.toml.

extent analysis

TL;DR

The Codex App's slow and fragile remote SSH connections may be improved by reusing the remote server and handling stale app-server state, similar to VS Code Remote SSH.

Guidance

  • Investigate the SSH gateway/NLB configuration to ensure it allows reuse of existing connections, which could reduce setup/reconnect time.
  • Verify that the codex app-server process is properly cleaned up after disconnection to avoid stale state and fixed-port conflicts.
  • Consider implementing a mechanism to detect and handle connection resets before authentication, providing clearer diagnostics for the user.
  • Review the related issues (#18503, #18547, #19300, #10450) for potential solutions or workarounds that may apply to this specific scenario.

Example

No specific code snippet is provided, as the issue is more related to configuration and connection handling.

Notes

The issue seems to be related to the interaction between the Codex App, SSH gateway/NLB, and remote host configuration. Further investigation into the specific configurations and connection handling mechanisms may be necessary to resolve the issue.

Recommendation

Apply a workaround to improve connection reuse and handle stale app-server state, as the root cause of the issue is likely related to the connection handling mechanism.

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…

FAQ

Expected behavior

Codex App remote SSH should feel closer to VS Code Remote SSH in reconnect behavior, or at least provide clearer diagnostics that distinguish:

  • SSH gateway / NLB reset before authentication
  • remote codex missing from PATH
  • remote authentication missing
  • stale codex app-server process
  • fixed port 127.0.0.1:9234 already in use
  • reconnecting to a stale/incorrect remote app-server

Ideally the app would reuse or clean up its remote app-server more robustly, avoid fixed-port collisions where possible, and show the exact failing layer instead of a generic connection failure.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING