Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: T3 Connect stays unreachable for ~7 minutes after the host wakes from suspend; cloudflared keeps reporting stale connections as ready #49584

Openvoltcrash(GitHub profile, opens in a new tab) opened this issue 0 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Run the T3 Code desktop app on Linux with T3 Connect turned on (managed cloudflared, HTTP/2).
  2. Connect the mobile app to it through T3 Connect.
  3. Suspend the laptop for a few minutes (here about 4.5 minutes), then wake it.
  4. Try to connect from the mobile app.

Expected behavior

The mobile app reconnects shortly after the host wakes and its network is back.

Actual behavior

The mobile app can't reach the host until the desktop app is quit and reopened. Its requests never reach the T3 server: the server trace shows zero requests arriving through the relay between the wake and the restart.

During that time:

  • cloudflared logged nothing at all after the wake: no Connection terminated, no retries. It apparently still believed its pre-sleep connections were live, so /ready kept answering 200 and the 30 s readiness watcher in ManagedEndpointRuntime.ts never restarted it.
  • The desktop client's own relay health check failed right after the wake (Relay environment health check reported offline, "Managed endpoint health request failed").
  • The local desktop window kept working normally over 127.0.0.1.
  • After the restart, the new cloudflared registered 4 connections within about 4 s, and the phone connected right away.

ConnectReachability.ts already handles exactly this case ("cloudflared can keep reporting ready connections the edge already dropped"), but it's too slow after a sleep:

  1. The periodic check (RECHECK_INTERVAL, 5 minutes) runs on a timer that doesn't advance while the machine is suspended. Here the last check ran 1 s after the suspend began, while the network was already going down, so it classified the failure as DNS, not a dead connector, and started no restart streak. The next check would only run about 5 minutes after the wake.
  2. Once that check sees the dead connector, DEAD_CONNECTOR_RESTART_AFTER waits another 2 minutes before restarting.

So after every suspend, remote clients are locked out for roughly 7 minutes. Nothing on the server reacts to a wake. The desktop app does get Electron powerMonitor resume events, but uses them only for telemetry and update checks, and the headless t3 server has no such signal anyway.

Suggested fix: detect sleep in the server itself (a gap between wall-clock and monotonic elapsed time when the timer fires), then run the reachability check right after the wake once the network is back, and restart a connector that reports ready connections but isn't reachable without waiting out the 2-minute streak.

Impact

Major degradation or frequent failure

Version or commit

Desktop AppImage, up to date as of 2026-12-05 (updater reported no update available). Mobile app 2.4.0 (iOS). Managed cloudflared 2026.10.4, HTTP/2.

Environment

Fedora 45 (Asahi, aarch64), wlroots-based Wayland compositor, Wi-Fi managed by NetworkManager. The machine suspends with s2idle.

Logs or stack traces

Times are the host's local time.

00:22:40.725  systemd-logind: Suspending...
00:22:40.728  NetworkManager: sleep requested, Wi-Fi deactivating
00:22:41      ConnectReachability.check -> "T3 Connect is NOT reachable ... address does not resolve" (network already down)
00:27:01      system returned from suspend
00:27:04.765  NetworkManager: CONNECTED_GLOBAL
00:27:05      RelayEnvironmentDiscovery.refreshStatus -> "Relay environment health check reported offline"
00:27:23, 00:28:19  desktop window RPCs over 127.0.0.1 succeed (vcs.refreshBranch etc.)
              (no relay-routed requests reach the server; no cloudflared output)
00:29:07      desktop app quit
00:29:21      "Relay client process started; waiting for tunnel connection"
00:29:22-26   4 tunnel connections registered
00:29:29      ConnectReachability.check -> "T3 Connect is reachable ... 4 connections · HTTP2"
00:29:37      mobile client connects through the relay

Periodic check times before the suspend, showing the 5-minute cadence: 23:52:40, 23:57:40, 00:02:41, 00:07:41, 00:12:41, 00:17:41, 00:22:41.

Workaround

Quit and reopen the desktop app after every wake.

#46936 is also T3 Connect getting stuck, but there cloudflared does reconnect and requests still fail on one connection. Here cloudflared never notices the drop.

🤖 Generated with Claude Code

  1. tanstack-source added labelsbug

Sign in to join this conversation.