Skip to content

Remote "Open in" ignores the environment's saved SSH route when another route is active #27203

Closed

Description

@fannar

What happened

Clicking "Open in Zed" in the thread sidebar for a remote environment fails in Zed with:

Failed to connect over SSH — failed to connect: Received disconnect from port 22:2: Too many authentication failures

The environment has three routes: Tailscale HTTPS (in use), Tailscale HTTP (found automatically), and a saved SSH route using the user's ~/.ssh/config alias (SSH <user>@<host>.<tailnet>.ts.net, alias <alias>). ssh <alias> works from a terminal. The user expected Zed to open the project over that SSH route.

Diagnosis

resolveRemoteOpenState (apps/web/src/remoteOpen.ts) only uses the SSH alias when the environment's active profile is an SshConnectionProfile:

sshTarget: profile !== null && profile._tag === "SshConnectionProfile" ? profile.target : null,

profile is entry.profile, the in-use route. When Tailscale is the in-use route, the saved SSH route in entry.alternateRoutes is never consulted. Remote open falls back to serverConfig.remoteOpenTargets[0], which the server builds in apps/server/src/environment/RemoteOpenTargets.ts as { kind: "tailscale", host: <MagicDNS name>, username: <server process user> }.

The resulting link (zed://ssh/<user>@<host>.<tailnet>.ts.net/...) dials the raw MagicDNS name, which doesn't match the user's Host <alias> block in ~/.ssh/config. Everything that block sets (IdentityFile, IdentitiesOnly, Port, ProxyJump, and so on) is skipped. On this machine the SSH agent (1Password) holds 12 keys and the right key is the 12th. The remote sshd's MaxAuthTries (default 6) disconnects the client before it reaches that key.

This isn't specific to Zed. Host resolution runs once, before buildRemoteOpenUrl (packages/contracts/src/editor.ts) produces the URL for each editor. So every remote-capable editor gets the same host: Cursor, VS Code, VS Code Insiders, VSCodium, Zed, and the JetBrains IDEs via Gateway. The affected entry points are the Open-in picker and its shortcut, chat file links (ChatMarkdown), FilePreviewPanel, and ChatView.

Suggested direction: when the environment has a saved SSH route (active or in alternateRoutes), prefer its alias for remote open over the server-advertised targets. The alias is the user's explicit SSH configuration.

Steps to reproduce

  1. On the client, use an SSH agent holding more keys than the remote's MaxAuthTries (6 by default), with the remote's key not among the first 6. Add a ~/.ssh/config block such as Host <alias> / HostName <host>.<tailnet>.ts.net / User <user> / IdentityFile <key>.
  2. Add a remote environment in the T3 Code desktop app, reached over Tailscale HTTPS (in use).
  3. Add an SSH route to the same environment using <alias>. ssh <alias> works from a terminal.
  4. Open a thread on that environment and click "Open in Zed" (or VS Code / Cursor) in the sidebar.
  5. The editor fails with "Too many authentication failures". Running ssh <user>@<host>.<tailnet>.ts.net true from a terminal reproduces the same error, which confirms the alias was bypassed.

Version

0.1.5-nightly.20261029.3877 (desktop app). No changes to remoteOpen.ts / RemoteOpenTargets.ts on main since that tag.

Environment

macOS 27.0 (darwin arm64), Node 26.12.1, desktop app connecting to a remote T3 Code server over Tailscale, Zed as the remote editor, 1Password SSH agent.

Evidence

$ ssh -o BatchMode=yes <user>@<host>.<tailnet>.ts.net true
Received disconnect from <tailscale-ip> port 22:2: Too many authentication failures
Disconnected from <tailscale-ip> port 22

$ ssh -G <alias>                    -> user <user>, identityfile <key>.pub
$ ssh -G <host>.<tailnet>.ts.net    -> user <local-user>, default identity files only
agent key order: the correct key is #12 of 12

Related issues

#8938 (added Zed remote open support): different issue. #24072 (same-Mac background services for Open in Zed): different issue. No existing issue covers the saved SSH route being ignored.

Fix applied or workaround

The user added the MagicDNS name to the existing Host line in ~/.ssh/config (Host <alias> <host>.<tailnet>.ts.net) so the editor's connection picks up the pinned key and user. Open in Zed works after that. T3 Code itself was not changed.

Filed by

Claude Code (claude-opus-5-5) via t3 triage

Activity

  1. BOAScripts commented on Nov 4, 2026

    @BOAScripts

    Same root cause here, different fallback target. Desktop 0.1.7, server 0.1.7 (Linux).

    I added the environment over HTTP (LAN), then added an SSH route by typing the ~/.ssh/config alias, which T3 picked up automatically. HTTP stays the in-use route, so "Open in Zed" ignores the saved SSH route and uses remoteOpenTargets[0]. Tailscale isn't running on the remote, so that entry is the mDNS one, <shortHostname>.local (RemoteOpenTargets.ts). Zed fails with "failed to open an ssh connection to <host>.local". ssh <alias> and Zed with the real hostname both work.

    The .local fallback can't work whenever client and server are on different subnets or VLANs, because mDNS is link-local and routers don't forward it. It also needs mDNS resolution on the client. So on routed networks with their own DNS, the saved SSH alias is the only host that works.

    This adds a second trigger beyond Tailscale: any environment reached over a LAN route with a saved SSH route gets the mDNS name. Still reproducible on main as of 2026-11-04, since remoteOpen.ts and RemoteOpenTargets.ts haven't changed.

    Workarounds:

    • a Host <host>.local / HostName <fqdn> block in ~/.ssh/config.
    • drag the ssh route at the top of the routes stack (in use)

    Triaged with Claude Code (claude-opus-5-5) via t3 triage.

    edits: found another workaround

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions