Skip to content

Sharing & access shows "No environment selected" when the desktop app connects to a background service with Local environment off #26420

Open

Description

@zakius

What happened

I run T3 Code as the background service (t3 service) and use the desktop app (.deb package, Linux) only as a client: Local environment is off, and the app connects to the service as a saved environment. That keeps the server independent of the desktop app, so app updates and restarts do not stop it.

When I try to set up guest links, Settings → Sharing & access only shows "No environment selected — Connect an environment to view its settings and access.", even though the service is connected and working. There is no way to link the machine to T3 Connect from the UI (or to unlink it), so guest links can't be used.

The Labs → Guest links row says "Needs T3 Connect: sign in and link this machine in Sharing & access", which points to this empty page.

The "Share with guest" dialog says "Guest links need a running T3 Connect tunnel." but doesn't say how to get one in this setup.

Diagnosis

Read from source at ce66aab1. main has the same code as of 2026-10-28.

  • apps/web/src/state/primaryEnvironment.ts: primaryEnvironmentIdAtom returns only a catalog entry whose target is PrimaryConnectionTarget, which is the backend the desktop app spawns itself. With Local environment off there is no such entry, so the primary environment id is null, even when a service on the same machine is connected.
  • apps/web/src/components/settings/ConnectionsSettings.tsx (~L1457): the connections-environment section branches on primaryEnvironmentId !== null. The null branch renders the "No environment selected" placeholder. The access view (if (showsAccess) return …primarySettings) renders only this section, with no way to pick a saved environment.
  • In that branch, CloudLinkRow renders only when canReadRelay || canManageRelay, and both are scopes of the (null) primary environment, so the T3 Connect link/unlink control never appears.
  • Server side, GuestShareService.create fails with connect_unavailable when no T3 Connect connector hostname exists (apps/server/src/guest/GuestShareService.ts ~L342). So "Share with guest" can't work until the machine is linked, and the UI gives no way to link it in this setup.
  • LabsSettingsPanel.tsx GuestLinksRow links users to /settings/access to do the linking.

Possible fixes: treat a connected service on the same machine as "This machine" when Local environment is off, or let Sharing & access pick any connected environment the user has access/relay scopes on.

Steps to reproduce

  1. Install and start the background service with t3 service install. It runs t3 serve on 127.0.0.1:3773.
  2. In the desktop app, turn off Local environment and connect to the service as a saved environment.
  3. In Settings → Labs, turn on Guest links.
  4. Open Settings → Sharing & access.
  5. Expected: the service's settings, including T3 Connect link/unlink. Actual: "No environment selected", with no T3 Connect row.
  6. Open a thread on the service and choose Share with guest → Create link. It fails with "Guest links need a running T3 Connect tunnel." (connect_unavailable).

Version

0.1.4-nightly.20261028.3814 (desktop app and background service, same build)

Environment

Linux x64 (PikaOS, kernel 7.2.4), Node v26.12.1, desktop .deb package (t3code 0.1.4~nightly.20261028.3814) + systemd user service

Evidence

# desktop-settings.json
"localEnvironmentEnabled": false

# server-runtime.json (service)
"serviceManaged": true, "port": 3773, "serverVersion": "0.1.4-nightly.20261028.3814"

# server settings
"guestSharingEnabled": true

# t3 connect status
T3 Connect
  Exposure: disabled
  Authorization: missing
  Environment link: not provisioned
  Relay: not provisioned
  Relay client: not installed

# after `t3 connect link` + `t3 service restart`
  Environment link: provisioned
  Relay: https://relay.t3.codes
✓ Other devices can reach this machine · Tunnel connected · 4 connections · QUIC

Related issues

#17013 (closed): the same "No environment selected" branch hid the Local environment toggle. That was fixed by moving the toggle to "This app". The Access page and T3 Connect controls for a non-primary environment are still unreachable.

Fix applied or workaround

Verified working from the CLI:

  1. t3 connect link (authorizes and stores the link; t3 connect status then shows "Environment link: pending server startup").
  2. t3 service restart. After about 30 seconds, t3 connect status shows "Environment link: provisioned · Tunnel connected", and Create link works.

Nothing in the UI points to this route. The tunnel also starts some seconds after the server, so a share attempt right after the restart still fails with the same error.

Filed by

claude (claude-opus-5-5) via t3 triage

Activity

  1. goncaloMgomes commented on Oct 31, 2026

    @goncaloMgomes

    I have exactly the same setup on 3 machines and i would also like to manage the server from the UI on the share and access page or other way. I currently have no way to access t3 connect management through the UI (Revoke tunnels, etc...)

    Also this setup(running a t3 service alongside the t3 code desktop could be improved) when starting the server the application won't start (I want the server to own .t3 folder) and I can't find a way to star a server from the application that runs when the application is closed.

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

    via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions