Skip to content

Codex App restores stale discovered SSH host state on startup and crashes with "No AppServerManager registered for hostId" #18556

Open

Description

@JuncongHe

What version of the Codex App are you using (From “About Codex” dialog)?

Version 26.415.40636 (1799)

What subscription do you have?

Pro

What platform is your computer?

Darwin 24.1.0 arm64

What issue are you seeing?

Codex App can get stuck restoring a stale discovered SSH host on startup.

In my case, the old discovered host ID was:

remote-ssh-discovered:192.168.195.80

After startup, the app tried to use that old host/project state even though it was no longer valid. This led to an internal error path and the app showed an error page.

Observed error:

No AppServerManager registered for hostId: remote-ssh-discovered:192.168.195.80

The UI then fell into an "Oops, an error has occurred" state.

What steps can reproduce the bug?

I cannot guarantee a minimal repro from scratch, but this is the state pattern that reproduced it on my machine:

  1. Use Codex App with Remote SSH / discovered SSH hosts.
  2. Have one or more remote projects associated with a discovered host ID like remote-ssh-discovered:<ip>.
  3. Later change/remove that host situation so the old discovered host is no longer valid.
  4. Restart Codex App.
  5. On startup, Codex restores previous remote project / host selection state.
  6. The app attempts to route requests to the stale discovered host ID and fails with No AppServerManager registered for hostId: ....

What is the expected behavior?

If persisted remote SSH state points to a stale or unavailable discovered host, Codex App should safely ignore or reconcile that state on startup.

It should not crash or show a fatal error page. It should fall back to a neutral state such as no active remote project, no auto-connect for the stale host, or a recoverable prompt asking the user to reselect a host.

Additional information

I investigated local persisted state and found the stale host was being restored from a local global state file rather than only the usual Application Support cache.

The stale references included data shaped like:

  • agent-mode-by-host-id["remote-ssh-discovered:192.168.195.80"]
  • remote-connection-auto-connect-by-host-id["remote-ssh-discovered:192.168.195.80"] = true
  • remote-cwds-by-host-and-workspace["remote-ssh-discovered:192.168.195.80"]
  • remote-projects[*].hostId = "remote-ssh-discovered:192.168.195.80"
  • active-remote-project-id

After clearing those stale references, the app started normally and no longer emitted:

  • remote-ssh-discovered:192.168.195.80
  • No AppServerManager registered for hostId: remote-ssh-discovered:192.168.195.80
  • Oops, an error has occurred

This suggests a startup reconciliation bug in persisted Remote SSH state, rather than an SSH config problem itself.

Suggested fix direction

On startup, if persisted remote host/project state references a discovered host that no longer has a registered app server manager, the app should:

  • drop the stale host binding
  • clear the active remote project selection for that host
  • disable auto-connect for that host
  • continue startup without surfacing a fatal error page

Activity

  1. added
    bugSomething isn't working
    appIssues related to the Codex desktop app
    app-serverIssues involving app server protocol or interfaces
    on Apr 19, 2026
  2. EvenOldridge commented on May 15, 2026

    @EvenOldridge

    Related stale Remote SSH state/reconnect issue observed on Codex App 26.513.20950 (2816) on macOS.

    This is not the exact stale-host/crash case from the issue body, but it looks like the same class of persisted/in-memory Remote SSH state not reconciling after the underlying host becomes healthy again.

    Scenario

    1. Use Codex Desktop with a discovered Remote SSH project, host id shaped like remote-ssh-discovered:<redacted-ssh-alias>.
    2. Let the laptop sleep / network drop while the remote connection is active.
    3. Wake the laptop.
    4. Refresh the underlying SSH/Teleport config externally and verify SSH is healthy.
    5. Attempt to reconnect/open the remote project in Codex Desktop.

    Observed

    The project/connection stayed greyed out with a timeout/error state even though direct SSH worked and the remote Codex binary was available:

    ssh <redacted-ssh-alias> 'test -x "$HOME/.local/bin/codex" && "$HOME/.local/bin/codex" --version'
    # codex-cli 0.130.0

    Relevant app log lines, with host details redacted:

    app_server_connection.transport_connect_failed errorMessage="SSH: codex path probe timed out after 30000ms" hostId=remote-ssh-discovered:<redacted> remoteConnectionMaxRetryAttempts=2 sshSetupStage=remote_codex_lookup transport=websocket
    app_server_connection.remote_connection_retry_disabled errorMessage="SSH: codex path probe timed out after 30000ms" hostId=remote-ssh-discovered:<redacted> reconnectAttempt=2 remoteConnectionMaxRetryAttempts=2 transportKind=websocket
    remote_connections.manager_state_set hostId=remote-ssh-discovered:<redacted> nextState=error nextError={"code":"connection-failed","message":"SSH: codex path probe timed out after 30000ms"}
    

    At this point, the underlying SSH path was healthy, but the Desktop UI appeared to keep serving the stale retry-exhausted connection error. Selecting/opening the remote project was not enough to force a fresh connection object. Cmd+R was unavailable/disabled in this production window.

    The workaround was to go to Settings > Connections and toggle auto-connect for the SSH host off and back on. That forced reconciliation/recreation of the Remote SSH connection:

    remote_connections.manager_state_set hostId=remote-ssh-discovered:<redacted> nextState=disconnected previousState=error source=host_connection_state_changed
    remote_connections.manager_state_set hostId=remote-ssh-discovered:<redacted> nextState=connecting previousState=disconnected source=host_connection_state_changed
    remote_connections.manager_state_set hostId=remote-ssh-discovered:<redacted> nextState=connected previousState=connecting source=host_connection_state_changed
    

    Additional detail

    There also seems to be a config/state mismatch around retry count. ~/.codex/codex-app/config.json had been set to:

    {"remoteConnectionMaxRetryAttempts": 20}

    but the running app logs still showed remoteConnectionMaxRetryAttempts=2, and the global state key remote-connection-max-retry-attempts was observed back at 2 after the Settings toggle. This suggests the app may be restoring or rewriting stale in-memory/global retry settings independently of the app config, and the retry-exhausted connection can remain stuck until the user toggles auto-connect.

    Expected

    When a Remote SSH connection is in retry-exhausted/error state, Codex Desktop should provide a direct retry/reconnect path from the greyed-out project or status badge. If the underlying SSH host is reachable again, selecting the project or clicking a reconnect control should clear the stale remote_connection_retry_disabled state and create a fresh connection attempt.

    Toggling auto-connect in Settings should not be the only way to recover a healthy remote host after sleep/network loss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appapp-serverIssues involving app server protocol or interfacesbugSomething isn't workingremote

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions