Repository navigation
fix(desktop): Local network pairing links prefer Wi-Fi or Ethernet over Hyper-V adapters - #27360
juliusmarminge wants to merge 3 commits into
Conversation
… Wi-Fi Adds a failing test that reproduces #27351: with the reporter's Windows interface order, the Local network link advertises the vEthernet (Default Switch) address instead of the Wi-Fi address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… adapters Fixes #27351 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — The default local-network pairing address now prefers physical adapters over Hyper-V vEthernet adapters, while preserving explicit overrides and fallback behavior. This changes a product default and requires human review, although server binding and exposure modes are unchanged. You can add or adjust custom eligibility rules. Learn more. |
Walkthrough
Merge Risk:
|
|
Tested this bug on a real Windows host: Windows 10 22H2 (19045), WSL 2 running Ubuntu and Docker Desktop. Node lists I ran
One problem with matching every it.effect("advertises a Hyper-V external switch address ahead of WSL NAT", () =>
withHarness(
{
"vEthernet (WSL (Hyper-V firewall))": [
{ address: "172.24.48.1", family: "IPv4", internal: false },
],
"vEthernet (External Switch)": [
{ address: "192.168.1.10", family: "IPv4", internal: false },
],
},
Effect.gen(function* () {
const serverExposure = yield* DesktopServerExposure.DesktopServerExposure;
yield* serverExposure.configureFromSettings({ port: 4173 });
const change = yield* serverExposure.setMode("network-accessible");
assert.equal(change.state.advertisedHost, "192.168.1.10");
}),
),
);Matching only the two NAT adapters fixes that case and still passes this PR's test (Tailscale, Default Switch, WSL, Wi-Fi). const HOST_ONLY_INTERFACE =
/^(bridge\d|utun|ipsec|ppp|tun|tap|wg|docker|br-|veth|virbr|vmnet|vboxnet|VirtualBox|VMware|vEthernet \((?:WSL|Default Switch))/;I have this as a branch with both tests and can open it as a PR if that is easier than updating this one. Tested with Claude Opus 5.5 in Claude Code. |
Problem
On Windows with Hyper-V or WSL2, Settings → Sharing & access → Create link → Local network can produce a pairing link for the
vEthernet (Default Switch)address (for examplehttp://172.25.80.1:3773) instead of the Wi-Fi or Ethernet address. Other devices on the LAN cannot reach that address. It happens whenever Windows lists a vEthernet adapter before the physical one: the desktop'sHOST_ONLY_INTERFACEfilter had novEthernetentry, so the first private IPv4 address won.Change
Adds
vEthernettoHOST_ONLY_INTERFACEinapps/desktop/src/backend/DesktopServerExposure.ts. Hyper-V switches are now ranked as fallbacks, like the VirtualBox and VMware adapters already on that list, so the physical adapter wins. A machine whose only private address is on a vEthernet adapter still advertises it. The server'sVIRTUAL_INTERFACEalready treatedvEthernetthis way.Scope and approval
Fixes #27351
Verification
New test
DesktopServerExposure > advertises the Wi-Fi address ahead of Windows Hyper-V switchesuses the reporter's adapter order (Tailscale,vEthernet (Default Switch),vEthernet (WSL (Hyper-V firewall)),Wi-Fi).AssertionError: expected '172.25.80.1' to equal '192.168.1.147'.vp test run src/backend/DesktopServerExposure.test.tspasses 11/11.vp run check:changedon 49b96eb passes format, lint, knip, typecheck and tests.Runtime transcript from real kernel interfaces. A Linux network namespace holds dummy adapters
vEthernet(DS)172.25.80.1,vEthernet(WSL)172.24.144.1 andWi-Fi192.168.1.147, created in that order, with the default route on Wi-Fi. A temporary, uncommitted test case passesos.networkInterfaces()through the realDesktopServerExposurelayer and switches it to network-accessible:Driver (scratch, not committed)
The rendered UI is unchanged: only the host string in the link changes, so there are no screenshots.
cannot-verify windows: not run on a Windows host with real Hyper-V adapters. Windows reports adapter names such as
vEthernet (Default Switch)to Node; the reporter's enumeration is reproduced above.Model and harness: Claude Opus 5.5 (Claude Code) as issue lead, test writer, implementer and reviewer B; GPT-6.1 Sol (Codex) as reviewer A.
🤖 Generated with Claude Code