Problem#
On a Mac with an unplugged Thunderbolt Bridge that kept its manual IPv4 address, Settings → Connections → Local network created pairing links for the bridge (http://192.168.2.1:3773/pair…) instead of Wi-Fi, so other devices could not connect. The desktop took the first eligible IPv4 address from os.networkInterfaces(), and bridge0 comes before en0 there. Fixes #17788.
Change#
The desktop now advertises an address on any other interface ahead of bridges, tunnels and VM adapters, which other devices usually cannot reach: macOS bridgeN, utun, ipsec, ppp, tun, tap, wg, Docker, libvirt, VMware and VirtualBox. An address on one of those is still used when no other interface has one. Otherwise the old order is kept, so the result only changes when the old pick was on one of those interfaces. An explicit advertised host still overrides everything.
The issue suggests the default-route interface. I didn't use it because a full-tunnel VPN owns the default route, so VPN users would get the tunnel address in their LAN pairing link. Ranking by interface name also needs no platform-specific route lookups.
Linux host bridges (br0, Proxmox vmbr0) and Hyper-V vEthernet external switches usually carry the real LAN address, so they keep their place. One known trade-off: a Linux bridge named exactly bridge0 (possible with NetworkManager) now loses to any other adapter that has an address, such as a USB tether.
Scope and approval#
Bug fix for #17788 that changes one function in the desktop backend. Nothing changes on the server: DirectEndpoints already filters container and VM interfaces for the extra routes it advertises.
Verification#
vp test run src/backend/DesktopServerExposure.test.ts in apps/desktop: 13/13 pass. There are two new tests. In the first, interfaces listed as bridge0, utun4, en0 advertise en0; this test fails on main. In the second, a vmbr0 host bridge still wins over a later enx… USB adapter.
tsc --noEmit for apps/desktop and lint on the changed file both pass.
- Not reproduced on real hardware: I don't have a Thunderbolt Bridge set up yet. Giving an unplugged Thunderbolt Bridge a manual IPv4 address on a Mac (macOS 26) didn't reproduce it, because macOS left the address off the inactive bridge, so it never showed up in
os.networkInterfaces(). The reported case is covered only by the unit test above.
Models#
- Development: Claude Opus 5.5 in Claude Code via T3 Code picked the issue and wrote the fix and tests.
- Review: GPT-6.1 Sol in Codex CLI reviewed it twice. The first draft promoted adapters with physical-looking names (
en, eth, wl, Wi-Fi). Sol showed this could pick a USB tether over a br0 LAN bridge, or an OpenVPN TAP adapter named "Ethernet 2" over a localized physical adapter, so the logic was inverted to demote known host-only names instead. Sol's second review found that demoting vEthernet broke Hyper-V external switches, so it was removed from the list, and flagged the Linux bridge0 trade-off noted above.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
5e310dfd-4422-46dc-9287-5dd230f32fdc📥 Commits
Reviewing files that changed from the base of the PR and between a908a7ac8780c5b4d6fb0bed8945d640f69d2d1d and 18912a8525aa6532a3099f7e570e810cc4c7bd6f.
📒 Files selected for processing (2)
apps/desktop/src/backend/DesktopServerExposure.test.tsapps/desktop/src/backend/DesktopServerExposure.tsIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough#
The LAN advertised-host resolver now prefers eligible IPv4 addresses on interfaces that do not match a host-only interface pattern. Tests cover Ethernet and Wi-Fi addresses appearing after bridge or tunnel addresses, and a host bridge appearing before an Ethernet adapter.
Changes#
LAN host selection
apps/desktop/src/backend/DesktopServerExposure.ts,apps/desktop/src/backend/DesktopServerExposure.test.tsHOST_ONLY_INTERFACE, then falls back to the first candidate ornull. Tests cover the selection order for Wi-Fi, bridge, tunnel, VM bridge, and Ethernet interfaces.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Suggested reviewers:
juliusmarmingeMerge Risk | ⚪ Minimal · up to
18912Merge Risk: ⚪ Minimal · up to
18912The resolver now favors addresses on interfaces not classified as host-only while retaining a fallback. No actionable merge-blocking risk is established by the supplied changes; the PR appears mergeable subject to normal checks.
Security Architecture Review
Security architecture risk: 🔵 Low · up to
18912The change affects the address advertised in local-network pairing links, not which interfaces the server listens on or how clients authenticate. No introduced security issue was established. Remaining uncertainty concerns which network the selected adapter actually reaches and the privacy of traffic on that network.
Retained concerns No architecture-level concerns identified.
Security review details
Security Blast Radius
Trust Boundaries and Controls
Pre-merge checks |
4
✅ Passed checks (4 passed)
#17788, explains the implementation and trade-offs, and reports focused test, type…#17788,resolveLanAdvertisedHoststill honors an explicit host override. Otherwise, it filters unusable and internal IPv4 addresses, prefers addresses outside the recognize…#17788. They modify desktop advertised-host selection and add focused tests for the new ranking and host-bridge fallback behavior. The diff contains no unrelated server b…✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands.