Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

remote-access.md

241 lines11.9 KB

1# Remote access
2​
3Connect a phone, browser, or another desktop app to T3 Code running on a different
4machine. That machine must stay running and reachable while you work.
5​
6## T3 Connect
7​
8T3 Connect makes an environment available to your other devices without setting
9up router forwarding. In the desktop app on the host, open **Settings →
10Connections**, sign in, and enable **T3 Connect** for that environment.
11​
12For a command-line host, run:
13​
14```bash
15t3 connect
16```
17​
18Follow the sign-in instructions. Setup offers a
19[background service](./background-service.md); if you decline it, start the
20server with `t3 serve`. Saving your sign-in alone does not make the machine
21reachable.
22​
23On your other device, sign in to the same T3 Connect account and choose the
24environment. Over SSH, the CLI prints a browser link and a short code. Open the
25link on any device, confirm the code matches, and approve. The CLI continues on
26its own, so you do not need to forward an OAuth callback port.
27​
28T3 Connect renews access credentials when needed without disconnecting a healthy
29connection. Pull request diffs and provider settings keep working after the
30previous credential expires. A failed renewal affects that request; it does not
31disconnect an otherwise healthy conversation.
32​
33## Pair over a LAN or private network
34​
35Use direct pairing when the other device can reach the host's network address.
36​
37On a desktop host, open **Settings → Connections**, enable **Network access**,
38then create a pairing link using an address the other device can reach. Changing
39network access restarts the desktop app. You can turn it off in the same place.
40​
41For a command-line host, replace `<private-ip>` with the host's LAN or tailnet
42address:
43​
44```bash
45t3 serve --host <private-ip>
46```
47​
48If a server is already running, generate a fresh link without restarting it:
49​
50```bash
51t3 pair
52```
53​
54Scan the QR code on your phone or paste the pairing URL into **Add environment**
55in the receiving app. Connection settings are under **Settings → Connections**
56on web and desktop and **Settings → Environments** on mobile. A loopback address
57such as `127.0.0.1` reaches only the device opening the link.
58​
59Pairing authorizes that device for future connections. Use a fresh one-time link
60for each new device; you do not need the original token to reconnect. Links
61created in Settings can only be copied from the client that created them while
62its Connections page stays open. If you leave or reload that page, create
63another link to share.
64​
65### Reach one machine several ways
66​
67A machine can have more than one route: LAN, Tailscale, a public URL, SSH, or
68T3 Connect. To add one, choose **Add route** in the machine's route list, or
69next to it in the T3 Connect list. Pairing the same machine again over another
70address also adds a route instead of a second machine. A new route is placed by
71speed, in that order, and you can reorder routes at any time.
72​
73While connected through T3 Connect or a paired address, T3 Code also learns the
74machine's current LAN and Tailscale addresses and adds them as routes, so
75pairing once through T3 Connect is enough to use the LAN at home. When the
76machine's LAN address changes, for example after it joins another Wi-Fi network,
77the learned route follows it. The machine must allow network access for its LAN
78address to be learned. You can reorder a learned route, but not remove it; it
79goes away with the route it was learned through, or when the machine stops
80reporting that address.
81​
82T3 Code connects over the first route that answers. Away from home, a LAN
83address that does not answer is checked briefly and skipped. It is only tried
84again, after the other routes, if none of them connect. While connected over a
85later route, T3 Code checks the earlier ones when your network changes, when you
86return to the app, and every minute, and moves back as soon as one works.
87​
88On web and desktop, select the route count under the machine's name in
89**Settings → Connections** to see its routes. Drag a route to change the order,
90or remove it. On mobile, open the machine under **Settings → Environments** and
91choose **Edit**. Signing out of T3 Connect removes only that route; a machine
92you can still reach another way stays saved.
93​
94### Balance new threads across machines
95​
96Auto balance is off by default. On web and desktop, enable it in
97**Settings → Connections → Load balancing** to automatically choose a machine for
98new threads in projects grouped across connected environments. The section
99appears once two or more machines are switched on.
100Each machine starts at **Normal**. Choose **Prefer** to favor it when it has CPU and
101memory available, **Less often** to reduce its share, or **Manual only** to exclude
102it from automatic selection. These are preferences, not fixed traffic percentages.
103Preferences are saved separately in each client.
104​
105The composer checks eligible machines when choosing a draft's environment, then keeps
106that choice stable. Choose **Auto balance** again to check current resources, or choose
107a specific machine to override it. Choosing a branch or worktree also keeps the draft
108on that machine. Existing threads stay where they started. If resource checks are
109unavailable or all eligible machines are full, choose a machine manually to continue.
110Mobile keeps its manual environment selection.
111​
112### Tailscale HTTPS
113​
114Join both devices to the same tailnet. In the desktop app, enable **Tailscale
115HTTPS** in **Settings → Connections**. Turn it off there to remove that route.
116​
117To start a command-line server with Tailscale HTTPS:
118​
119```bash
120t3 serve --tailscale-serve
121```
122​
123For an already-running server:
124​
125```bash
126t3 pair --tailscale
127```
128​
129The pairing link uses an address such as `https://machine.tailnet.ts.net/`.
130The mapping created by `pair --tailscale` persists across restarts. Remove its
131default-port mapping with:
132​
133```bash
134tailscale serve --https=443 off
135```
136​
137If that port is already in use, choose another with
138`--tailscale-serve-port`. See `t3 pair --help` for other pairing options.
139​
140### Hosted web app
141​
142[app.t3.codes](https://app.t3.codes) needs an HTTPS endpoint. It connects directly
143to your server; a hosted pairing link does not make an unreachable backend
144reachable or convert HTTP to HTTPS.
145​
146For a plain HTTP LAN endpoint, use the direct pairing URL in a browser that can
147open it, or pair from the desktop app. On mobile, an IP address entered without a
148scheme uses HTTP, so include `https://` when your server uses HTTPS.
149​
150## Desktop-managed SSH
151​
152In the desktop app, open **Settings → Connections → Add environment**, choose
153**SSH**, and enter a host or SSH alias such as `user@example.com`. T3 Code starts
154or reuses a server there and opens the port forward for you. Projects, provider
155credentials, and agent work stay on the remote machine.
156​
157The remote host must be Linux or an Apple Silicon Mac with `curl` or `wget`,
158`tar`, `sha256sum` or `shasum`, and [provider setup](./install.md#providers).
159The first launch downloads T3 Code's server to `~/.t3/runtime` on the host, so
160it takes longer than later ones.
161Provider CLIs must be on the `PATH` of a non-interactive login shell there;
162check with:
163​
164```bash
165ssh user@example.com 'sh -lc "command -v claude codex"'
166```
167​
168If SSH reconnecting fails after an app update, retry the launch once. Removing
169the connection stops a server that T3 Code launched; a server that was already
170running is left alone.
171​
172For Antigravity's Google callback on a remote host, see
173[remote sign-in](./providers-antigravity.md#sign-in-from-a-remote-device).
174​
175## Manage or revoke access
176​
177On the host, **Settings → Connections** lets authorized administrators create
178pairing links and revoke client sessions. Revoking an unused link prevents new
179pairings; revoke a device's session to remove its existing access. Command-line
180management is available through `t3 auth --help`.
181​
182A session with an open connection stays listed after its access credential
183expires.
184​
185To remove an environment from T3 Connect, open your account menu's **T3 Connect**
186page, or **Settings → T3 Connect** on mobile, and choose **Deregister**. This
187revokes its cloud access and frees its host space even when the environment is
188offline or has been wiped. Removing an environment from a device's connection
189settings only forgets it on that device; it stays registered to your account.
190​
191When idle tunnel cleanup is enabled, T3 Connect removes a linked environment's
192tunnel after it stays offline for several minutes. The environment stays linked
193and keeps the same address. When the host starts again or wakes, T3 Connect
194creates a replacement tunnel on its own. You do not need to pair again. Cleanup
195usually runs five to ten minutes after the tunnel goes down.
196​
197T3 Connect also removes the tunnel of an environment running an older version of
198T3 Code once it has been offline for seven days. That environment shows a message
199asking you to update. Start T3 Code on that computer and update it to the latest
200version; it reconnects at the same address without pairing again.
201​
202On a command-line host, `t3 connect unlink` disables exposure while retaining
203your login; `t3 connect logout` also clears that login. Background-service
204[removal](./background-service.md#manage-the-service) is separate.
205​
206Treat pairing URLs and authorization codes as passwords. Do not include them in
207screenshots, logs, or bug reports.
208​
209## T3 Connect troubleshooting
210​
211Run `t3 connect status` on the host to inspect saved authorization and link
212configuration. It is not a live reachability check. If the environment appears
213offline, run `t3 service status` and read the displayed log. If it disappears
214when SSH closes, see [background-service troubleshooting](./background-service.md#troubleshooting).
215​
216| Error | Recovery |
217| --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
218| `environment_link_limit_exceeded` or managed tunnel limit | Deregister an unused environment, then restart T3 Code on the host. |
219| `auth_invalid` or `invalid_bearer` | Run `t3 connect login`. If credentials were revoked, run `t3 connect logout`, then `t3 connect` again. Restart the server after signing in. |
220| Expired or invalid link proof | Check the host's date and time, update T3 Code, then restart it. |
221| HTTP 403 without a recognized error | Check relay access, proxies, and firewall rules. Keep any Cloudflare Ray ID for a bug report. |
222| HTTP 408, 429, or 5xx | Check network and relay availability. Startup retries temporary failures for up to ten minutes. |
223​
224After fixing a permanent rejection, restart the host's server. On Linux, use
225`systemctl --user restart t3code.service` for the background service. For a
226foreground server, stop it and run `t3 serve` again with your usual options.
227Include the diagnostic message and trace ID when reporting a persistent failure.
228​
229For a connection that still fails after linking, check the date and time on both
230devices. For server version warnings, follow [Updating T3 Code](./updating.md).
231​
232## Using the Desktop App as a Remote Only
233​
234If a computer should only drive work running elsewhere, turn off its local environment. In the
235desktop app, open **Settings → Connections** and switch off **Local
236environment**. T3 Code restarts without a local server: no local agents or terminals run, WSL
237backends stay off, and other devices can no longer connect to this computer. Your projects,
238history, and saved connections are kept, and you keep working through pairing, T3 Connect, or SSH.
239​
240Switch **Local environment** back on in the same place to restart with your previous local
241settings.