Skip to content
Source
Sign inSign up
pingdotgg/t3code

desktop: network access falls back to local-only when LAN interface is up late #41447

Closedmr-avp(GitHub profile, opens in a new tab) opened this issue 1 comment

Summary

On macOS, after a Mac reboot, the T3 Code desktop app restores the persisted serverExposureMode: "network-accessible" setting but immediately logs bootstrap fell back to local-only because no advertised network host was available and binds its HTTP server to 127.0.0.1:3773 instead of all interfaces. An already-paired iPhone keeps the correct LAN endpoint (http://172.16.1.87:3773/) and can ping the host, but every request fails with T3 Code on Mac AVP did not answer / Retrying · attempt 1. Restarting the desktop app manually after the interface is up fixes it (*:3773). Expected: the app should retry or retain LAN binding once a usable interface appears, instead of silently falling back to loopback for the whole session.

Environment

  • T3 Code version: 0.1.11-nightly.20261119.4928 (Nightly)
  • OS: Darwin 27.2.0, arm64 (mac-mini); Darwin Kernel Version 27.2.0: Wed Oct 14 23:47:07 PDT 2026; root:xnu-13432.41.4~25/RELEASE_ARM64_T8132
  • Terminal: N/A (desktop app; no terminal environment variables)
  • Shell: /bin/zsh
  • Install/channel: Nightly, /Applications/T3 Code (Nightly).app
  • Active plugins: N/A

Reproduction

  1. On a Mac with several network interfaces where the LAN interface receives its address only after boot/login (here en8, "Display Ethernet", 172.16.1.87/21, DHCP router 172.16.0.4), enable network access in T3 Code and pair the iPhone app over that LAN address.
  2. Reboot the Mac and let T3 Code start automatically.
  3. On the iPhone open Environments → the Mac AVP entry shows http://172.16.1.87:3773/, then red T3 Code on Mac AVP did not answer and Retrying · attempt 1.

Expected Behavior

The server binds 0.0.0.0:3773, the advertised endpoint stays reachable, and the paired iPhone connects without any manual action after a reboot.

Actual Behavior

  • lsof -nP -iTCP:3773 -sTCP:LISTEN (before manual restart): T3 Code 617 ... TCP 127.0.0.1:3773 (LISTEN)
  • curl http://172.16.1.87:3773/ → exit code 7 (connection refused)
  • curl http://127.0.0.1:3773/ → HTTP 200
  • server-runtime.json: "host":"127.0.0.1", "port":3773, "startedAt":"2026-11-22T22:17:13.289Z"
  • desktop-settings.json: "serverExposureMode":"network-accessible"
  • t3 status: Local network off
  • After manually restarting T3 Code: T3 Code 32302 ... TCP *:3773 (LISTEN) and the iPhone reconnects normally.

Additional Context

Trace log desktop.trace.ndjson.8, runId 68c0ebc1b8d2:

bootstrap restoring persisted server exposure mode {"mode":"network-accessible"}
bootstrap fell back to local-only because no advertised network host was available {"effect.logLevel":"WARN"}

Reachability is not the problem: the iPhone pings 172.16.1.87 successfully (6–8 ms, 8/8 packets). Mac interfaces at the time: en0 192.168.1.6/24 (default gateway 192.168.1.1), en1 Wi-Fi not associated, en8 "Display Ethernet" 172.16.1.87/21.

Relevant code (from the local Nightly bundle):

  • DesktopServerExposure.ts: DESKTOP_LAN_BIND_HOST = "0.0.0.0" is used only when the resolved mode is network-accessible; local-only uses DESKTOP_LOOPBACK_HOST = "127.0.0.1".
  • resolveRuntimeState() falls back to local-only when requestedExposure.endpointUrl === null and no Tailscale address exists. resolveLanAdvertisedHost() only considers non-internal IPv4 addresses, so at boot, before en8 has a lease, there is no advertised host.
  • withCurrentAdvertisedHost() updates the advertised host when interfaces change, but does not re-evaluate the bind host. This leaves the server on loopback for the rest of the session even though the LAN address is now present.

Frequency: reproducible after a Mac reboot in this setup; a manual app restart always fixes it.

Workarounds: restart T3 Code once the interface is up, or set T3CODE_DESKTOP_LAN_HOST=172.16.1.87 in the app's launch environment so the advertised host override is available at boot.

Screenshots are attached to the original thread (Environments screen with the error; iPhone ping to 172.16.1.87).

  1. tanstack-source added labelsbug

  2. This is the same problem as #17362, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.

  3. juliusmarminge closed this

Sign in to join this conversation.