Skip to content

[Bug]: Saved T3 Connect environments keep their original label after the host's machine name changes #15683

Open

Description

@jlipworth

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

(The bug is in packages/client-runtime, which all clients share — web, desktop and mobile — plus infra/relay.)

Steps to reproduce

  1. Link a Mac whose ComputerName is JL-Mac-Studio-M3-Ultra to T3 Connect, then add it as an environment on a client.
  2. Move to a new Mac with Migration Assistant. It copies ~/.t3/userdata/environment-id, so the environmentId stays the same. The new machine is named JL-Mac-Studio-M5-Ultra.
  3. Start T3 Code on the new Mac. In the client from step 1, open Settings → Connections → Environments and check the environment chip in the composer.

Expected behavior

The environment is shown as JL-Mac-Studio-M5-Ultra. That is the name the server reports in its descriptor, and the name a fresh T3 Connect discovery list shows.

Actual behavior

Settings → Environments and the composer environment chip still show JL-Mac-Studio-M3-Ultra, next to "T3 Connect · Connected". A T3 Connect environment that has not been saved on the client yet shows the new name.

The host itself is fine. scutil --get ComputerName, scutil --get LocalHostName, scutil --get HostName and hostname all return JL-Mac-Studio-M5-Ultra. The server reads its label from scutil --get ComputerName every time it starts (apps/server/src/environment/ServerEnvironmentLabel.ts).

Impact

Cosmetic issue

Version or commit

Desktop 0.0.46-nightly.20261004.2648; main @ 4ee6bfd

Environment

macOS 27.0.1, Apple M5 Ultra, T3 Code (Nightly) desktop, T3 Connect

Logs or stack traces

No response

Screenshots, recordings, or supporting files

Composer chip shows JL-Mac-Studio-M3-Ultra

Settings environments row shows JL-Mac-Studio-M3-Ultra

Workaround

From reading the code (not tested): remove the saved environment and add it again from T3 Connect. The label is copied from discovery again when the environment is added.


Root cause

Two copies of the label are stored, and neither one is ever updated:

  1. The client's saved target keeps the label it had when it was added. When an environment is added, RelayConnectionTarget.label is copied from the discovery record. This happens in apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx, apps/mobile/src/features/connection/useConnectionController.ts, and the legacy migration in apps/desktop/src/app/DesktopConnectionCatalogStore.ts. Settings and the composer chip display that catalog entry. On every connect, ConnectionResolver.authorize in packages/client-runtime/src/connection/resolver.ts fetches the live ExecutionEnvironmentDescriptor, but it only compares environmentId and discards descriptor.label. Discovery results are never written back into saved targets either. Bearer and SSH saved environments store label the same way, so they probably have the same problem.
  2. The relay link row is only updated on an explicit re-link. relay_environment_links.environment_label is written only by EnvironmentLinks.upsert in infra/relay/src/environments/EnvironmentLinks.ts. That runs when the environment is linked through desktop T3 Connect linking or t3 connect. A server boot does not refresh it, so discovery also shows the old name if the host is renamed without re-linking.

Suggested fix

  • Smallest fix: once authorize succeeds, compare descriptor.label with target.label. If they differ, write the new label to the catalog entry. The descriptor is already fetched on every connect, so this adds no request, and it fixes relay, bearer and SSH environments together.
  • Optional: when relay discovery refreshes, sync the labels of saved relay targets so that offline environments also get the new name.
  • Relay: refresh environment_label when the server re-establishes its managed endpoint.
  • If Manage T3 Connect environment names and registrations #13057 adds custom names that apply across the account, the rule should be "follow the advertised machine name unless the user renamed it". That keeps it to one label instead of adding a second label field.

Related

Activity

  1. jlipworth commented on Oct 4, 2026

    @jlipworth
    Author

    Screenshots, taken on the client after the host was renamed to JL-Mac-Studio-M5-Ultra:

    Composer environment chip: still shows the old name

    Composer chip shows JL-Mac-Studio-M3-Ultra

    Settings → Environments: old name, connected through T3 Connect

    Settings environments row shows JL-Mac-Studio-M3-Ultra, T3 Connect · Connected

  2. juliusmarminge commented on Oct 4, 2026

    @juliusmarminge
    Member

    Note

    Grok responding on behalf of Julius.

    Triage

    Thanks for the thorough report, @jlipworth. The Migration Assistant detail and the root-cause notes lined up well with the code.

    What I found

    Confirmed on main at 4ee6bfd50e. This is separate from #13057.

    • The saved label never updates. Settings → Environments and the composer chip show the saved catalog label (entry.target.label). That label is copied once, when the environment is added: in CloudEnvironmentConnectList, in the mobile connect path, and in the desktop catalog migration.
    • The live name is fetched but dropped. ConnectionResolver.authorize loads the live ExecutionEnvironmentDescriptor on every connect and checks environmentId, then discards descriptor.label. Relay auth and discovery health also read the descriptor, but neither writes the name back to the saved target.
    • Why remove and re-add works. EnvironmentRegistry.register replaces target.label, which matches the workaround you suggested.
    • When the server advertises a new name. resolveServerEnvironmentLabel runs scutil --get ComputerName once per process, so a restart is what picks up the new name.
    • The relay row is a narrower gap than described. environment_label is written only by EnvironmentLinks.upsert. Startup calls that only when managedTunnelStartupAction returns reconcile_link, so an already-linked host that comes back ready keeps its old relay label. Your unsaved T3 Connect row showing the new name suggests the link was refreshed during the migration, which points to the saved catalog as the stale copy here.
    • Other environment types. Bearer and SSH targets store label the same way, so they're probably affected too. The local primary and desktop-local backends already rebuild from the descriptor.

    Likely fix area

    • One option: after a successful authorize, update the catalog entry's label whenever descriptor.label differs. That needs no extra request and covers relay, bearer, and SSH targets alike.
    • Optionally, sync saved relay targets from discovery, and refresh environment_label for already-linked hosts on startup.
    • How this should work alongside the custom names requested in Manage T3 Connect environment names and registrations #13057 is still open.

    A maintainer will decide on the fix direction.

  3. added
    bug
    via-triage
    on Oct 4, 2026
  4. timharris707 commented on Oct 18, 2026

    @timharris707

    Claude Opus 5.5 via Claude Code, responding on behalf of Tim Harris:

    Adding a data point from #21270, which was closed as a duplicate of this issue. On 0.1.0, running t3 connect link again, and even t3 connect unlink followed by t3 connect link, did not refresh the relay's environment_label. The old name kept showing in a fresh discovery list and under T3 Account > T3 Connect > Registered servers, not only in saved entries.

    So a fix that only updates the client's saved label after authorize would not cover this case. The relay seems to keep the label from the first link for as long as the environment identity exists.

    #21270 also describes a separate problem this issue doesn't cover: after creating a new environment identity, every client got environment_link_not_found until a full t3 connect logout and sign-in. Happy to file that on its own if it's useful.

  5. juliusmarminge commented on Oct 22, 2026

    @juliusmarminge
    Member

    Checked current main at b5a226e49c in an isolated Linux worktree. Ran vp run dev, opened the web client, then Settings → Connections → Add environment. This development build offers only host/code pairing, with no T3 Connect discovery, so I could not run the saved-relay rename sequence. The real-data snapshot also failed migration, so this attempt used empty state. This is not a successful reproduction or evidence that the bug is fixed.

    Can you confirm on the latest nightly whether restarting the renamed host leaves (1) its saved environment label and (2) its fresh T3 Connect discovery label stale? Include the client and host versions. The later comment reports both labels staying stale, whereas the original report says fresh discovery has the new name.

  6. added
    needs more info
    on Oct 22, 2026
  7. YasserDRIF commented on Oct 26, 2026

    @YasserDRIF
    Contributor

    Another repro on the current release, for the "saved label stale after host restart" case.

    Host: macOS (arm64), T3 Code server 0.1.2

    Steps

    1. Renamed the Mac from Yasser's MacBook Pro (2) to Yasser - Suture (scutil --set for ComputerName, LocalHostName, and HostName).
    2. Quit T3 Code desktop fully and reopened it.
    3. Force-closed the iOS app and reopened it. It's connected to this host through T3 Connect.

    Result

    • The host now advertises the new name. The environment descriptor returns label: "Yasser - Suture" with the same environmentId as before.
    • The desktop app shows the new name.
    • The mobile app still shows Yasser's MacBook Pro (2) for this environment after a full restart of both the host and the app.

    So (1) the saved environment label on the mobile client stays stale even though the restarted host advertises the new name. I haven't checked (2), the fresh discovery list, yet. I'll add the mobile app version and the discovery result when I have them.

  8. removed
    needs more info
    on Oct 26, 2026
  9. Hormold commented on Nov 6, 2026

    @Hormold

    +1, hit this today on 0.1.8 nightly. got 2 macs paired and they show up as "MacBook Pro" and "MacBook Pro 4" lol. renamed the second one in macos, its server already returns "Old Mac" from /.well-known/t3/environment but the desktop app still shows MacBook Pro 4

    only way i found to fix it is remove from this device -> new pairing code -> pair again. thats too much for a name change

    can you just add Rename to the ... menu in Settings > Connections? local name only, nothing on the server. and if i didnt set a custom name just take the label from the server on reconnect, that would fix this issue too

  10. jacobcorbett commented on Nov 6, 2026

    @jacobcorbett
    Contributor

    Additional reproduction on stable 0.1.7 (6 November 2026): native Windows 11 host, macOS desktop client, T3 Connect.

    After renaming the Windows machine, the same environment identity advertised its new name through /.well-known/t3/environment. Both the saved client environment row and the fresh T3 Connect discovery row continued to show the old name. The peer-linked environments section already showed the new name.

    What we checked:

    • Restarting the macOS client did not update the name.
    • Removing the saved environment from the Mac left an unsaved discovery row with the old name, so this was also the relay account record, not only the saved target.
    • Restarting the Windows T3 scheduled task did not update discovery.
    • t3 connect unlink, t3 connect link --headless, and restarting the host caused startup link reconciliation. The macOS discovery/saved row then showed the new name.

    The unlink operation initially reported upstream_unavailable; subsequent startup reconciliation succeeded. The descriptor retained the same environment ID. We did not create a new identity.

    The relink also caused a separate client-side outage matching #27250: the tunnel was connected, but the client's recursive DNS chain cached NXDOMAIN for its hostname while a public resolver returned valid records. HTTPS to the exact environment descriptor endpoint succeeded when resolved to the public address. A domain-specific DNS resolver override restored normal client connectivity. This reinforces the value of refreshing the advertised name without unlinking/relinking.

    PR #27542 addresses saved client labels; this reproduction also needs the relay discovery label refreshed for an already-linked host. No claim of reproduction on the latest nightly or current main.

  11. moultonpoint commented on Nov 12, 2026

    @moultonpoint

    Reproduced on T3 Code 0.1.9 with an Ubuntu host and macOS client. The server and cloud registration reported “Ubuntu Mac,” but the client retained the original name. Updating the saved connection label through T3’s internal bridge and reloading the window fixed it. A user-facing Rename action would avoid this workaround.

  12. afurgal commented on Nov 16, 2026

    @afurgal

    Confirming on T3 Code 0.1.9 (macOS, desktop host): after changing the host's ComputerName, I needed both steps, in this order, before clients showed the new name:

    1. Re-link the host (Settings → Sharing & access → T3 Connect off/on), then restart T3 Code on the host.
    2. On each client, remove the saved environment and add it again from T3 Connect.

    Either step alone left the old label. That fits there being two stale copies: re-linking refreshes the relay's stored label, and re-adding refreshes the client's saved label (which is only copied when the environment is added). It may also explain the mixed reports above on whether re-linking alone works.

  13. scuba78 commented on Nov 18, 2026

    @scuba78

    Claude Opus 5.5 via Claude Code, posting on behalf of @scuba78:

    Another repro on v0.1.9 (host and client), answering the question above. Whether it stays stale depends on how the host is linked.

    Setup: a Linux host (Incus container, t3 serve with a CLI-desired T3 Connect link) was renamed from t3-agent to MAYA. Two Windows hosts, whose servers run inside the desktop app, were renamed from CasperTwo to CASPER-3 and from DESKTOP-V6RDGP6 to BALTHASAR-2. All were restarted or rebooted, and each server's descriptor now reports the new label.

    Update after further investigation (corrects my first version of this comment, which said all hosts stayed stale):

    • Relay records (GET /v1/environments): MAYA is updated. CasperTwo and DESKTOP-V6RDGP6 are still the first-link labels. The client UI shows exactly these, so removing and re-adding a host through T3 Connect discovery gives the new name for the Linux host and the old one for the Windows hosts. (Adding the Linux host as a new environment on a second client also showed MAYA.)
    • Only the link proof carries the label. It's the descriptor inside makeCloudLinkProof → POST /v1/client/environment-links. Tunnel register/recover proofs, publish and link-preference requests carry no label, and the client sends none of its own. Health responses include the descriptor, but the relay label didn't change from those alone.
    • CLI-linked hosts re-link on every restart, which is why the Linux one refreshed. releaseManagedTunnelOnShutdown deletes the relay tunnel and local runtime config. Next start: registerManagedTunnelRecovery → not_linked → managedTunnelStartupAction → reconcile_link → fresh link proof with the current hostname. Logs from the restart: Released the managed tunnel on shutdown, then T3 Connect desired link reconciled on startup. Afterwards the relay label was MAYA. linkedAt was left unchanged.
    • Desktop-app-hosted servers (Windows here) never re-link. There's no CLI desired link, so the tunnel isn't released on shutdown, startup registration returns ready, and the relay keeps the first-link label indefinitely.
    • Re-adding an already-linked host in the desktop app doesn't re-link it either. linkEnvironmentToCloud only runs when !linked || linkRevoked || managedTunnel mismatch, so the client just re-reads the stale relay record. This matches the earlier report that unlink/link didn't help for some setups.
    • Peer environment links between hosts (agent-to-agent) show the new names correctly throughout.

    Possible fix directions: let the relay refresh environment_label from the signed health descriptor, or re-send the link proof (or a label-only update) when the descriptor label differs from the relay record. A user-facing rename, as in #13057, would also cover it.

    One more data point: each Windows client labels itself correctly (the local environment shows BALTHASAR-2 and CASPER-3 respectively), but labels the other Windows host with its relay label. CASPER-3 appears as CasperTwo on BALTHASAR-2, and BALTHASAR-2 appears as DESKTOP-V6RDGP6 on CASPER-3. The Linux host shows as MAYA everywhere. So the local environment label is rebuilt from the live descriptor, and the stale value lives only in the relay record that remote clients read.

  14. benjamin-di commented on Nov 21, 2026

    @benjamin-di
    Contributor

    Confirming this still reproduces on 0.1.11 (Ubuntu 26.04 host using /etc/machine-info PRETTY_HOSTNAME, iOS and desktop clients):

    • Host was initially linked to T3 Connect before its hostname and PRETTY_HOSTNAME were changed from the default installer name (user-System-Product-Name).
    • Server descriptor reported the updated PRETTY_HOSTNAME, but both the desktop and iOS clients kept showing user-System-Product-Name.
    • Running t3 connect unlink, t3 connect link, and restarting t3code.service refreshed the relay record, and removing + re-adding the environment in the iOS app picked up the updated name.
  15. aswansyahputra commented on Nov 23, 2026

    @aswansyahputra

    Another data point on 0.1.11, macOS desktop host + two clients. This one has a clear before/after and confirms the host itself was correct the whole time.

    Environment

    • Host: macOS (darwin arm64, macOS 27.2.1), T3 Code Desktop 0.1.11, server 0.1.11, linked to T3 Connect. Machine renamed bumina → macbook (ComputerName, LocalHostName, HostName).
    • Clients: T3 Code Desktop 0.1.11 on a second Mac, and the Android mobile app.
    • Both clients had the environment saved through T3 Connect (never through a pairing code), so every session on the host was T3 Connect · mobile/desktop.

    Symptom

    After the rename and a full restart of T3 Code on the host, the server descriptor already reported the new name:

    GET /.well-known/t3/environment
    {"label":"macbook", "environmentId":"<unchanged>", "serverVersion":"0.1.11", ...}
    

    but every client kept showing bumina — the desktop client, the Android app, and the host's own "Linked environments" header on the other machine. Not a per-device cache: three surfaces, one stale name.

    What fixed it

    Two separate writes were needed, in this order.

    1. Re-link T3 Connect on the host. Settings → Sharing & access → pick the renamed environment → T3 Connect switch off, then on. The server trace shows the fresh link rather than a recovery:

    environment.cloud.makeLinkProof   → relayJwt.sign   (signed from the live descriptor)
    environment.cloud.applyRelayConfig → activateManagedTunnel
    

    The relay client also restarted with a new tunnel id (not the one from the original link). This is the only path that rewrites the relay's environment_label, since the upsert in EnvironmentLinks only runs from a link proof.

    2. Remove and re-add the environment on each client. Re-adding copies the current label into that client's saved catalog. Removing alone is not enough — the discovery row still carries the relay's copy, which is why step 1 has to come first.

    After both steps, the same two clients show macbook everywhere: saved row, discovery row, and the "Linked environments · …" header on the peer.

    Caveats on this report

    • I did not capture a fresh (un-added) discovery row before step 1, so I cannot prove the relay record was still bumina at that moment. What I can say is that the saved client copy alone does not explain a device showing the old name after re-adding, and that the re-link was required before the clients would pick up the new name.
    • A host restart between the re-link and the client re-add did not disturb the label: startup ran registerManagedCloudTunnelRecovery (a recovery, not a link), so the label written by the re-link proof survived.
    • This matches @afurgal's comment that both steps are needed, in that order, and @jacobcorbett's finding that the stale name survives removing the saved environment.

    Suggested behaviour

    Applying the label from the descriptor on reconnect (as #27542 / #36311 propose) would cover the client copy. The relay copy still needs its own refresh path — re-linking to fix a name change is a lot of ceremony for a rename.


    Reported via T3 Code triage on 0.1.11. Diagnosis and write-up by [NusaGate] DeepSeek V4.1 Flash running in OpenCode.

  16. salimmohamed commented on Nov 24, 2026

    @salimmohamed

    Still reproduces on 0.1.12-nightly.20261124.5209, and it isn't limited to T3 Connect targets. Saved environments added over Tailscale keep their first label too.

    I renamed five hosts with T3CODE_ENVIRONMENT_LABEL instead of changing the machine name: two Windows hosts running the desktop app, a macOS host running the background service, a macOS host running the desktop app, and a Linux host running the systemd service. After restarting each host, its descriptor returns the new label and peer environment links pick it up on the next t3 environment list. The Windows desktop client still shows the old labels (salims-mac-mini (3), server-pc-wsl WSL) in Settings → Connections and the sidebar, even after a full quit and relaunch of the client while it's connected to those hosts. Only its own local environment shows the new name.

    One more pointer for whoever picks this up: clientRuntime.connection.onboarding.updateBearerConnection in the client runtime can already rewrite a saved bearer environment's label and keep its credential, but nothing in the UI calls updateBearer. Wiring it to a Rename item would cover #31238 for bearer targets, and #27542 would cover the rest.

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

    bugvia-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions