Repository navigation
fix(web): Open in VS Code uses the LAN address the client reached - #21
Merged
Merged
Conversation
A client on the LAN got a link to the server's tailnet name, which it may not be able to resolve. When sshd is listening and the connected route is direct and non-public, the editor link now uses that route's host with the advertised username. An SSH profile alias still wins. The server now marks sshd-backed targets explicitly, so a Tailscale-SSH-only host keeps its tailnet name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also moves the test fixture to a neutral LAN address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A client that reaches a remote server over the LAN gets an Open in VS Code link to the server's tailnet name when the server has one, even if the client is not on the tailnet. On the reporting setup, a desktop connected by LAN address and not on the tailnet ended up in an empty VS Code window in Restricted Mode.
The server side of this is confirmed: the client's connection came over the LAN, the client has no tailnet entry, and sshd listens on all interfaces with Tailscale SSH off. Nothing on the client machine was inspected, including the VS Code error and whether Remote-SSH is installed. That the failed connection causes Restricted Mode is an inference.
Fix
When sshd is listening and the client is connected over a direct, non-public route, the link uses that route's host with the advertised username, for example
dev@192.168.1.50. An SSH profile alias still wins.sshd: trueinstead of the client inferring it from themdnstarget. A Tailscale-SSH-only server has no marker and keeps its tailnet name. Older clients ignore the field, and a client talking to an older server keeps the old link.lan,tailnetandvpnfromconnectionRouteKind. That covers private IPv4,.local, bare hostnames, MagicDNS names and 100.64.0.0/10 addresses. Tailscale qualifies for the same reason as the LAN: the client has already reached the server at that host. A MagicDNS connection gets the same link as before. A connection to a bare 100.x address now gets that address instead of the MagicDNS name..localhostand0.xaddresses, which name the client itself. These keep today's behaviour.ChatMarkdown.tsxonly checksmode !== "local-exec"and passes no targets, so it is unaffected and unchanged.Known limits
Rollout
The web code is bundled in the desktop app, so the desktop needs a release with this change. The server must also be updated to send
sshd. Until both are updated, the link stays as it is today.Verification
vscode://vscode-remote/ssh-remote+<user>%40<lan-address>/<path>, using the host's real sshd and Tailscale state. That was a browser, not the desktop app, and VS Code itself was not exercised.remoteOpen.test.tsandRemoteOpenTargets.test.ts, typecheck for contracts, web and server, plus lint and format, pass.vp run check:changedcould not run:git diffsegfaulted in the sandbox before any check started.🤖 Generated with Claude Code