Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): local network pairing links skip idle bridges and tunnels #18085

MergedTinBane(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/18085/headmerged by juliusmarminge View on GitHub

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.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Review in Change Stack →

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 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.ts
      • apps/desktop/src/backend/DesktopServerExposure.ts

      Included 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

      Layer / File(s)Summary
      Interface-based host preference
      apps/desktop/src/backend/DesktopServerExposure.ts, apps/desktop/src/backend/DesktopServerExposure.test.ts
      The resolver collects eligible external IPv4 addresses with their interface names. It prefers the first address whose interface does not match HOST_ONLY_INTERFACE, then falls back to the first candidate or null. 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: juliusmarminge


      Merge Risk | ⚪ Minimal · up to 18912

      Merge Risk: ⚪ Minimal · up to 18912

      The 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 18912

      The 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

      • inferred — The assessed scope is one desktop backend and its pairing clients. In network-accessible mode, code-level listening already covers all IPv4 interfaces rather than only the advertised one. Actual attacker reachability and traffic-observation scope remain dependent on routing and firewall configuration that was not supplied.

      Trust Boundaries and Controls

      • observed — Operating-system interface names influence advertisement, not authentication authority. Authentication policy derives from the server bind host, pairing credentials are issued by the server, and authenticated HTTP middleware verifies credentials before providing a principal. These inspected consumers are unchanged between the PR base and head.

      Pre-merge checks | Passed 4
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Title checkPassedThe title clearly describes the primary change: pairing links no longer prefer idle bridge and tunnel interfaces.
      Description checkPassedThe description includes complete Problem, Change, Scope and approval, and Verification sections. It identifies issue #17788, explains the implementation and trade-offs, and reports focused test, type…
      Linked Issues checkPassedFor directly linked issue #17788, resolveLanAdvertisedHost still honors an explicit host override. Otherwise, it filters unusable and internal IPv4 addresses, prefers addresses outside the recognize…
      Out of Scope Changes checkPassedThe changes stay within issue #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)
      • Create a new PR


      Comment `@coderabbitai help` to get the list of available commands.
    3. juliusmarminge added labelsmacroscope-review

    4. Approvability

      Verdict: Approved at 18912a8

      Macroscope's review found this PR approvable — This is a contained desktop bug fix that changes LAN pairing links to prefer reachable interfaces over known idle bridges, tunnels, and VM adapters while preserving overrides and existing fallback behavior. Focused tests cover the changed selection logic, with no product-default, schema, deployment, or static-analysis changes.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. juliusmarminge merged this8832d5c

    6. juliusmarminge closed this

Sign in to join this conversation.