Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Two machines sharing a copied T3 home split one T3 Connect tunnel, and relinking one takes the other offline #37634

ClosedYasserDRIF(GitHub profile, opens in a new tab) opened this issue 1 comment

Claude Opus 5.5 via Claude Code, writing on behalf of YasserDRIF.

Before submitting

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

Area

T3 Connect: apps/server (identity), infra/relay (link, credentials, tunnel)

Steps to reproduce

  1. On Mac A, link T3 Connect and pair a phone.
  2. Copy Mac A's ~/.t3 to Mac B with Migration Assistant, Time Machine or rsync. Start T3 Code on both. Both now have the same userdata/environment-id and secrets/cloud-link-ed25519-key-pair, cloud-relay-environment-credential and cloud-relay-url.
  3. Request https://<managed-hostname>/.well-known/t3/environment repeatedly. The answers come from either Mac. In the phone app, threads land on either one.
  4. Deregister the environment, or run t3 connect link on one Mac. The other Mac's T3 Connect stops working while its connector still reports a healthy tunnel.

Expected behavior

A copied T3 home is detected, and the second machine gets its own identity, or at least a clear warning, before it joins another machine's tunnel. For example, the server could record a machine fingerprint (such as the macOS IOPlatformUUID or Linux machine-id) next to environment-id. A mismatch would then mean "this is a copy". Only the maintainers can decide how far to take that, so this is an issue rather than a PR.

Actual behavior

Nothing on either side notices that two machines share one environment identity.

  1. Both Macs run a connector for the same managed tunnel, and Cloudflare splits traffic between them. I sent 20 requests to the T3 Connect hostname and counted the matching spans in each server's trace log. 6 reached the new Mac. The other 14 were answered by the old Mac, whose label in the response was different. The tunnel name comes from userId + environmentId (infra/relay/src/deploymentConfig.ts:85-91). ManagedEndpointProvider.provision reuses an existing tunnel by name (ManagedEndpointProvider.ts:1279-1287), and the link upsert overwrites on (userId, environmentId) (EnvironmentLinks.ts:209-225). Nothing checks for a second host.
  2. Relinking or deregistering one copy breaks the other. EnvironmentCredentials.create revokes every other active credential for the same (environmentId, environmentPublicKey) (EnvironmentCredentials.ts:153-166). Deregistering revokes them all and deletes the DNS record (Api.ts:479-563, ManagedEndpointProvider.deprovision). The surviving Mac kept running cloudflared with 4 live connections, but its hostname returned HTTP 530 / Cloudflare 1016 and the relay answered not_authorized.
  3. The server trusts the copied ID forever. ServerEnvironment.makeIdentity (apps/server/src/environment/ServerEnvironment.ts:86-183) uses whatever is in environment-id and has no machine check.

Impact

After a routine Mac migration, the phone controls the wrong machine about two thirds of the time with no error. Cleaning up the old machine through T3 Connect then takes the new one offline. Working out what happened took a long investigation of the logs.

Version or commit

T3 Code 0.1.9 (desktop) on both Macs; relay at relay.t3.codes; cloudflared 2026.10.4. Code references are against main at 1f698f01.

Environment

macOS (arm64) on both Macs, desktop app as host; iOS app as client; one T3 Connect account.

Workaround

Stop T3 on the old machine, or move its secrets/cloud-relay-* aside. Give it a fresh environment-id before linking it again. Then run t3 connect link on the machine you keep and restart T3 Code there.

  • #27359: the same copied ID makes pairing silently do nothing. This issue covers the T3 Connect side: split traffic, and one copy revoking the other.
  • #15683: stale labels. With two hosts behind one tunnel, the label a client sees depends on which host answered.
  • #28213: a reinstalled Mac keeps an old T3 Connect identity.
  1. tanstack-source added labelsbug

  2. This is the same problem as #27359, 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.