Skip to content

[Bug]: T3 Connect switch stays off after startup restores the tunnel #6628

Description

@coygeek

Before submitting

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

Area

apps/web

Steps to reproduce

  1. Set up the desktop environment with npx t3 connect, so a managed T3 Connect link is restored on server startup.
  2. Restart T3 Code, for example when a Nightly update relaunches the desktop app.
  3. Open Settings > Connections while the server is still reconciling the desired T3 Connect link.
  4. Wait for the managed tunnel to come online and confirm that T3 Connect health checks or remote access work.
  5. Look at the T3 Connect switch again.

Expected behavior

The switch should update to on when startup reconciliation restores the managed tunnel. It should represent the server's current link state, even if the first read happened before reconciliation finished.

Actual behavior

The switch can stay off after the tunnel is restored and working. This makes it look as though T3 Connect disabled itself after an update or restart.

I captured one occurrence with this order of events:

10:02:31  environment.cloud.readLinkState succeeded
10:02:32  environment.cloud.applyRelayConfig succeeded
10:02:32  environment.cloud.reconcileDesiredLink succeeded
10:03:11  Settings screenshot still showed T3 Connect off
10:04:57  managed T3 Connect health request succeeded
10:05:42  managed T3 Connect health request succeeded

The persisted managed-endpoint runtime configuration was also present from 10:02:32 onward. I redacted the tunnel hostname, tunnel ID, account data, tokens, and local paths.

The source looks consistent with a startup race:

  • primaryCloudLinkState.ts reads link state through an SWR atom and exposes an explicit refresh.
  • useCloudLinkController.ts renders the switch from managedTunnelActive. Its refresh calls are tied to mutations started by this controller.
  • server.ts reconciles CLI-desired T3 Connect state in a parked startup fiber after routes are already available.
  • http.ts reports managedTunnelActive from the presence of the runtime configuration.

If the initial link-state request lands just before applyRelayConfig, the atom receives managedTunnelActive: false. I could not find an invalidation when background startup reconciliation changes that state one second later, so the unchecked switch can outlive the stale read.

Impact

Minor bug or occasional failure

Version or commit

T3 Code Desktop Nightly 0.0.34-nightly.20260814.1093, commit 184d8ef33b8f42869fb84f66a33984185b81dc47

Environment

macOS 26.5.2, Apple Silicon, T3 Code Desktop Nightly

Logs or stack traces

No error was reported. Startup reconciliation and later managed-endpoint health checks succeeded.

Screenshots, recordings, or supporting files

A screenshot is available showing Network access on, T3 Connect off, and Publish agent activity on after the managed endpoint configuration had already been restored.

Workaround

Leave the switch alone when remote T3 Connect access still works. Navigating away long enough for the atom to expire, restarting the renderer, or forcing a fresh link-state read should update the display. Toggling the stale switch may provision the link again unnecessarily.

Activity

  1. coygeek commented on Aug 14, 2026

    @coygeek
    Author

    Follow-up with another observation from the same environment on 0.0.34-nightly.20260814.1093.

    At 10:19 AM I enabled the T3 Connect switch again. The local traces show that the managed tunnel was already active before I did so:

    • Managed endpoint health checks succeeded at 10:17:46, 10:18:56, and 10:19:03.
    • The existing cloudflared process had been running continuously since 10:02:32.
    • Enabling the switch at 10:19:42 reapplied the relay configuration and refreshed the link state, but did not start a new cloudflared process.
    • Another managed endpoint health check succeeded at 10:19:43.
    • No cloud, relay, or connect operations failed during the toggle.

    This confirms that the disabled switch was stale UI state, not an inactive tunnel. Toggling it on caused the controller's mutation path to refresh the cached state.

  2. maslinedwin commented on Aug 16, 2026

    @maslinedwin
    Contributor

    Opened a fix in #7193.

    The Connections switch was rendering a cached pre-reconcile managedTunnelActive: false from the first link-state read. The PR refreshes that atom once after the first settled read, and again when Settings → Connections opens, so the switch can catch up after startup restore without a manual toggle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions