Remote SSH Desktop reuses stale app-server and masks model_not_found as Reconnecting
What happened?
When using Codex Desktop with a remote SSH project, the UI got stuck showing reconnect retries after the first message:
Reconnecting... 2/5
Reconnecting... 3/5
Reconnecting... 4/5
From the UI, this looks like a transport/WebSocket problem. However, the remote Codex logs showed the real error was a model/catalog/access error:
stream disconnected - retrying sampling request (1/5 ... 5/5)
Turn error: stream disconnected before completion: The model `gpt-5.5` does not exist or you do not have access to it.
The app-server WebSocket event also contained:
{"type":"error","error":{"type":"invalid_request_error","code":"model_not_found","message":"The model `gpt-5.5` does not exist or you do not have access to it."}}
The confusing part: running the remote CLI directly with the same model worked:
codex exec -C <remote-project> --skip-git-repo-check -m gpt-5.5 -s read-only 'reply OK'
Result:
OpenAI Codex v0.124.0
model: gpt-5.5
...
OK
While debugging, I found an old remote app-server process still listening on the remote host:
codex app-server --listen ws://127.0.0.1:9234 # started Apr 21
After killing the old app-server process, Codex Desktop spawned a fresh remote app-server:
codex app-server --listen ws://127.0.0.1:9234 # started Apr 24
This suggests the Desktop remote-SSH path may be reusing a stale remote app-server whose runtime/model catalog/auth state no longer matches the current CLI/Desktop configuration. It also suggests model_not_found is being presented to the user as generic Reconnecting..., which makes the root cause hard to diagnose.
Environment
- Codex Desktop client:
26.422.21637from logs - Remote host: Ubuntu
24.04.3 LTS - Remote Codex CLI:
codex-cli 0.124.0 - Auth mode: ChatGPT login
- Remote connection type: Codex Desktop remote SSH project
- Model configured/used:
gpt-5.5 - Remote sandbox note: Ubuntu AppArmor/bubblewrap issue was already fixed;
bwrap --ro-bind / / truesucceeds andcodex app-server </dev/nullexits successfully.
Expected behavior
- If an existing remote app-server is stale, Codex Desktop should detect that during handshake and restart it or refuse it with a clear diagnostic.
- If the backend returns
model_not_found, the Desktop UI should show a model/catalog/access error instead ofReconnecting.... - The remote app-server handshake should probably include enough version/model-catalog/auth metadata for Desktop to know whether it can safely reuse the process.
Actual behavior
- Desktop UI only showed reconnect attempts.
- Remote logs showed
model_not_found. - Direct remote CLI with
gpt-5.5succeeded. - A stale
codex app-server --listen ws://127.0.0.1:9234process was still running and appeared to be reused until it was manually killed.
Possibly related
- #18471: Desktop first turn shows
Reconnecting - #18556: stale discovered SSH host state
- #15057: Ubuntu/AppArmor sandbox diagnostics for bubblewrap/user namespaces
- #19224: model catalog /
gpt-5.5default-model discussion
Suggested fix direction
- Add remote app-server preflight/handshake checks: server version, start time or generation, auth mode, and model catalog compatibility.
- Restart or invalidate an existing remote app-server when the current Desktop/CLI configuration no longer matches.
- Map backend
model_not_foundto a clear UI message instead of retrying as if it were only a connection problem. - Optionally add a diagnostic command or log line for the exact remote app-server PID Desktop connected to.
7 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
i tried killing the processes that didn't help but points to problem, but what worked for me was (a bit overkill):
then the desktop app picked it up and indicators went green finally.
This might be related.
In my case:
Environment:
Seems consistent with stale remote app-server behavior.
Additional finding from the same setup: this also affects the Add remote project flow, not only the first-turn
Reconnecting...symptom.After the remote SSH host had working
ssh,codex,bwrap, and an existing remote app-server, Codex Desktop still showed only the local macOS project picker when trying to add a project. In other words, the user could add local Mac projects, but could not get the remote-project picker/path flow forubuntu-dev.Two state/config details looked relevant:
remote_control = truewas present, the Desktop add-project UI still behaved as local-only.remote_connections = trueappears necessary for the remote-project UI path, even thoughcodex features listdoes not surfaceremote_connectionsandcodex features enable remote_connectionspreviously returned an unknown-feature error.There was also stale Desktop global state:
Both remote project paths existed on the remote host. However, while Codex Desktop was running, manually patching
selected-remote-host-idback toremote-ssh-discovered:ubuntu-devwas overwritten by the app process and reverted to the stale selected host.So there may be another related bug here:
remote_connections, while newer config/UI guidance points users towardremote_control.selected-remote-host-id, causing the add-project flow to stay local-only or point at the wrong discovered host even when validremote-projectsalready exist forubuntu-dev.Expected behavior: if valid remote projects exist and auto-connect is enabled for a host, the Add Project UI should expose the remote project/path picker for that host, or show a clear diagnostic explaining which feature flag or host state is blocking it.
Additional data point from macOS Codex Desktop on 2026-04-24: a remote host can appear to log in as the wrong Linux user even when the SSH alias has already been updated and resolves correctly.
What I observed:
ssh -G <alias>resolved to the intended useruser@hosttargetHowever, on the remote machine there was still a stale Codex
app-serverowned by the previous Unix user listening on the fixed local websocket port:This made Desktop behave as if the remote session was still the old user, because the SSH tunnel connected to the already-running stale app-server on
127.0.0.1:9234instead of forcing a clean per-user app-server lifecycle.What fixed it:
app-serverprocesses, especially the one owned by the old user.After that, the wrong-user symptom disappeared.
So this looks like a broader variant of the stale remote app-server bug: the stale server can leak not only model/runtime state, but also the previous remote Unix-user context, which is much more confusing because it looks like SSH user selection is being ignored.
Another likely-related remote failure mode on macOS Desktop, observed on 2026-04-25:
The same remote host had multiple Codex binaries installed at the same time, for example:
0.122.0-alpha.130.124.0-alpha.2Symptoms:
read ECONNRESETWhat made this confusing is that the remote host had previously worked with a newer remote app-server version, but later Desktop began attaching to an older remote binary/app-server again.
Evidence pattern:
readyz/healthzendpoints were reachable through SSH port forwardingSo this looks like another bug in the same area:
read ECONNRESET, instead of a clear version-selection / version-mismatch diagnosticExpected behavior:
ECONNRESETOne more concrete failure mode in the same stale remote app-server area:
Codex Desktop starts the remote app-server with a fixed
/tmplog path:If that file was previously created by another remote Unix user, the current SSH user cannot write it, so shell redirection fails before
codex app-serverstarts. Desktop then only reports websocketread ECONNRESET, which hides the real cause.Suggested fixes:
/tmp/codex-$UID/...,$XDG_RUNTIME_DIR, or~/.codex/log/....Permission denied,codex not found,Address already in use, and version mismatch.codexPATH, log writability, port ownership, and app-server health before showing a generic reconnect error.