Skip to content

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

Closed as duplicate

Description

@YasserDRIF

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.

Related

Activity

  1. juliusmarminge commented on Nov 16, 2026

    @juliusmarminge
    Member

    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.

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