Skip to content

Remote SSH connection fails when remote login shell is csh/tcsh #19302

Open

Description

@vananth-nv

What happened?

Codex Desktop Remote Connections can discover an SSH host from ~/.ssh/config, but enabling the connection fails during remote app-server bootstrap when the remote account's login shell is /bin/csh.

Normal SSH to the host succeeds, passwordless auth works, and the remote has both /bin/bash and /bin/sh installed. The remote codex app-server --help command also works when run manually. The failure appears to happen because the Desktop remote bootstrap is executed through the remote login shell and uses Bourne/bash-style syntax or -l flags that csh does not accept.

Sanitized log excerpt

[remote-connections/discovery] discovery_completed collectedAliasCount=1 ... resolvedConnectionCount=1
[WindowContext] [ssh-websocket-v0] selected app-server transport websocketUrl=ws://127.0.0.1:<local-port>/rpc
[AppServerTransportSshWebsocket] ssh_websocket_v0.ensure_remote_app_server_and_tunnel localPort=<local-port> remotePort=<remote-port> sshAlias=<redacted> sshHost=<redacted> sshPort=<redacted>
[AppServerConnection] app_server_connection.transport_connect_failed
errorMessage="Unmatched '''.
fi: Command not found.
Unknown option: `-l'
Usage: csh [ -bcdefilmnqstvVxX ] [ argument ... ]."

Environment

  • Codex Desktop on Windows
  • Codex app version observed in local install/logs: 26.422.2437.0
  • Remote app-server version reported by logs: 0.124.0-alpha.2
  • Remote host: Unix/Linux via SSH
  • Remote login shell: /bin/csh
  • /bin/bash and /bin/sh are available on the remote
  • SSH auth works normally outside Codex Desktop
  • Host alias, hostname, user, and ports intentionally redacted

Expected behavior

Codex Desktop Remote Connections should either:

  1. bootstrap through a POSIX shell explicitly, e.g. /bin/sh -lc ..., regardless of the account login shell;
  2. support csh/tcsh login shells with compatible syntax; or
  3. expose a per-connection "remote bootstrap shell" setting, e.g. /bin/bash, so users can keep their login shell as csh for existing remote workflows.

Why changing the login shell is not always viable

Some enterprise environments require csh/tcsh login shells for existing tool setup. In this environment the shell is managed by central account tooling and cannot be changed locally. Users may need to keep csh as the login shell while allowing Codex to use sh/bash only for its bootstrap.

Activity

  1. added
    bug
    app
    app-server
    windows-os
    on Apr 24, 2026
  2. github-actions commented on Apr 24, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. vananth-nv commented on Apr 24, 2026

    @vananth-nv
    Author

    include csh/tcsh in the bug if you want to close this as duplicate @codex

  4. maybejeb commented on Sep 24, 2026

    @maybejeb

    Additional impact: remote diagnostics must preserve the account's login shell

    I encountered the same C-shell compatibility boundary in a managed Linux remote-workflow environment, but at the diagnostic layer rather than only during app-server bootstrap.

    Environment

    • Remote host: Linux via SSH
    • Remote account login shell: /bin/csh (verified in the active terminalf)
    • Workflow: C-shell-dependent tooling environment
    • The host also has Bash available, but Bash and C-shell initialize different command environments

    Observed behavior

    A remote diagnostic was wrapped in Bash before the remote account's login shell was identified. That changed the effective initialization and PATH, and produced a false negative:

    codex: Command not found
    

    That result did not establish that Codex was absent from the host. It established only that it was unavailable in the prematurely selected Bash environment. The account's actual interactive workflow is C-shell, where the required tooling is initialized differently.

    This class of error is costly because it can send an agent down an incorrect troubleshooting path and consume time/quota while investigating a shell-induced false negative.

    Root cause

    The diagnostic chose /bin/bash as an implementation convenience before establishing the remote user's configured login shell. On enterprise hosts, C-shell startup can provide required PATH, proxy, module, and tool initialization. A Bash wrapper is therefore not an equivalent observation environment.

    Expected behavior

    Before making environment-sensitive claims such as command not found, remote workflows should:

    1. detect the remote account's configured/login shell;
    2. preserve that shell for ordinary diagnostics; and
    3. use Bash or POSIX shell only when a specific operation requires it, clearly labeling any result as Bash-specific.

    Suggested regression coverage

    Add a remote C-shell fixture whose startup environment exposes a command not present in Bash. Verify that bootstrap and diagnostic paths either preserve the configured shell or explicitly report the shell override; they must not report a host-level missing-command conclusion based only on the override.

    This is complementary to the existing C-shell bootstrap failure: shell selection affects not only initial app-server startup, but also the correctness of subsequent remote diagnosis.

    Anonymized recurrence evidence: 250 recent local session records

    To check whether this was an isolated incident, I reviewed 250 readable local Codex session records spanning roughly four months. This was a local, anonymized review: no hostnames, user names, file paths, command contents, credentials, or transcript excerpts are included here.

    The figures below are session-level signals, not a claim that every match is an independently adjudicated defect. One session can match more than one category. Even with that conservative caveat, the recurrence is substantial:

    Shell-compatibility trap Sessions with signal
    Bash syntax emitted in a C-shell context (2>&1, $(...), [[, export) 182
    Bash selected or wrapped before the login shell was identified 162
    C-shell argument, parser, or redirection failure 78
    Shell/PATH-scoped command not found false lead 59
    Nested quoting failure 19

    These are not merely cosmetic command translations. In a C-shell-dependent engineering environment, each occurrence can create an avoidable failed attempt, an incorrect PATH diagnosis, repeated environment discovery, and additional interactive agent work. That is costly in elapsed engineering time and in metered agent/token usage, particularly when the agent loses context and retries a Bash-shaped solution.

    The recurring failure pattern is: assume Bash first; discover the actual login shell only after a failure. The safe product behavior should be the reverse: detect and report the effective remote login shell before generating shell syntax, selecting startup files, changing PATH assumptions, or treating a command lookup failure as evidence that a tool is absent.

    Suggested regression gate: a remote /bin/csh or /bin/tcsh fixture that asserts (1) shell detection precedes command construction, (2) generated diagnostics use valid C-shell syntax, (3) Bash is used only for an explicit, labeled Bash requirement, and (4) command-not-found results are not generalized across shell initialization contexts.

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

    appapp-serverbugremotewindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions