fix(pairing): say what to check when a local-network host never answers - #68
Merged
Merged
Conversation
This was referenced Aug 28, 2026
Pairing against an RFC1918 address fails at the transport layer whenever the phone is on mobile data, on another SSID, or holding an address the desktop only had on an earlier network. All three surfaced as a bare `HttpClientError: Transport error`, which reads like a dead backend and gives nobody a next step. Name the unreachable host and the thing to check. Alongside it, stop promoting a scheme-less local host to `https://`: typing `192.168.1.21:3773` built an https URL against a plain-HTTP desktop, so the handshake failed and produced the same opaque transport error. The shared `isPrivateNetworkHostname` predicate backs both, and deliberately excludes the 100.64.0.0/10 range Tailscale uses — those route over the tailnet, so local-network advice would be wrong there. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Owner
Author
|
Rebased on What remains here is the part upstream does not have: the shared One gap this leaves, noted for later: upstream's Tests after the rebase: shared 353, client-runtime 489, mobile 556 — all passing. |
enisze
force-pushed
the
fix/pairing-local-network-diagnostics
branch
from
August 28, 2026 18:24
1396f31 to
e907807
Compare
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.
Follow-up to #67, which fixed the desktop advertising a stale LAN address. That was a real bug — the desktop now advertises the machine's current address — but it left the other half of the same failure untouched: when the phone genuinely can't reach the address, the app says nothing useful.
Problem
Every one of these produced the identical message:
192.168.xaddress is reachable at all;A raw
Transport errorcan't distinguish "your phone isn't on this network" from "the server is dead", so there's no next step to take.Second, smaller bug in the same path:
buildPairingUrlpromoted any scheme-less host tohttps://. Typing192.168.1.21:3773therefore built an HTTPS URL against a plain-HTTP desktop backend — the TLS handshake failed and surfaced as, again, an opaque transport error.Changes
packages/shared/src/privateNetworkHost.ts(new) —isPrivateNetworkHostname/isPrivateNetworkUrl: loopback,10/8,172.16/12,192.168/16,169.254/16, IPv6 loopback +fc00::/7+fe80::/10,localhost, and.localmDNS names. It deliberately excludes the100.64.0.0/10CGNAT range Tailscale hands out: those are private but route over the tailnet, so local-network advice would be actively misleading.packages/client-runtime/src/rpc/http.ts— a transport failure against such a host now appends: "Nothing answered at 192.168.2.37:3773. That address only works from the same local network, so check this device is on that network (mobile data cannot reach it) and that the address still matches the computer — it changes when the computer joins another network." The raw detail is kept so the message stays diagnosable, and routable hosts are unchanged. Benefits mobile and web, since both render this error.apps/mobile/src/features/connection/pairing.ts— scheme-less local hosts gethttp://, routable hosts still default tohttps://, explicit schemes are untouched.Tests
buildPairingUrlcovering scheme selection, explicit schemes, the code-less case, and aparsePairingUrlround-trip.Full suites green for all three touched packages:
packages/shared353,packages/client-runtime489,apps/mobile559. Lint and format clean.What this does not fix
If the phone is on cellular or a different network, this only makes the app say so — the connection still can't work. Verified while writing it: the desktop serves
http://192.168.1.21:3773/.well-known/t3/environment(200,serverVersion 0.0.30) with the macOS firewall disabled, and the server trace shows zero inbound requests from the phone, so the failing request never reaches the machine.🤖 Generated with Claude Code