Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/desktop (logic in packages/client-runtime)
Summary
An environment has a working T3 Connect route and Tailscale routes whose saved bearer login has expired. The client keeps sending the expired bearer token to the Tailscale addresses once a minute, indefinitely. It already holds a valid T3 Connect DPoP token, and the code says that token works on the environment's tailnet address (authorizeDpop with directEndpoint), but the Tailscale routes never use it. The only fix is to pair again, and #17014 says re-pairing doesn't reliably reach sibling or learned routes, which leaves removing the whole environment.
#17014 covers re-pairing not updating sibling routes, and #33183 covers the 30-day expiry with no renewal before 0.1.11. This issue is about the step neither covers: an environment that is still authenticated through Connect should not leave its direct routes stuck on a dead login.
Steps to reproduce
- Before 0.1.11, pair a desktop client to two Linux hosts so each environment gets a plain bearer login and Tailscale routes (MagicDNS HTTPS and
http://<tailnet-ip>:3773). Also link T3 Connect. - Upgrade the client and hosts to 0.1.14 nightly and wait past the bearer session's 30-day expiry.
- Open Settings → Environments.
Expected behavior
While the environment has a valid T3 Connect session, its Tailscale/LAN routes authorize with that DPoP token, which authorizeDpop({ directEndpoint }) already supports. Failing that, once the host returns 401 "Session token expired", the client stops resending that token and offers one action that repairs every direct route.
Actual behavior
- T3 Connect is "In use". Both Tailscale routes show "Sign-in refused", and nothing on screen offers a way to fix them except Remove.
- The client never stops retrying. Each attempt does
GET /.well-known/t3/environment(200), thenPOST /api/auth/websocket-ticket/rpc(401). One host logged 802Rejected authenticated session credential. reason="Session token expired."in a day. - Client span chain for each failure:
ConnectionDriver.preflight→broker.prepare→broker.authorize {target.kind: BearerConnectionTarget}→broker.bearer→remote.authorizeBearer→issueRemoteWebSocketTicket→ "The environment rejected this client's credentials (invalid_credential)." t3 auth session liston each host shows only a livedpop-access-token/cloud-connectsession for this client, plus an MCP bearer session. Nothing usable exists for the direct routes, so retrying cannot succeed.
Why (read against main @ a505181)
resolver.ts#L154: a bearer route uses the Connect token only if its profile saysauthorization: "t3-connect". Otherwise it loads the stored credential and callsauthorizeBearer, which has no renewal or fallback.routes.ts#L322(mergeLearnedRoutes): learned routes that already exist are kept as they are.authorization: "t3-connect"is set only on newly learned origins. A route learned from (or saved as) a direct bearer pairing therefore keeps borrowing that dead credential, even after Connect becomes the active route.service.ts#L86: "a token from the relay also works on the environment's LAN or tailnet address". The fallback exists; this path just never uses it.EnvironmentAuth.ts#L1169: only DPoP pairing-link sessions renew. A bearer login from before 0.1.11 is bound to expire, so every environment paired before 0.1.11 will reach this state.
Suggested fix
- When a bearer route's credential is rejected as expired or revoked and the environment has a Connect route, switch that route to
authorization: "t3-connect"(or tryauthorizeDpop({ directEndpoint })before giving up). InmergeLearnedRoutes, upgrade existing learned routes tot3-connectonce the shared credential is dead. - Stop retrying a credential the host rejected as expired, and show one "Re-pair" action for the environment, as in [Bug]: After re-pairing, an environment's other routes keep the expired login, and removing a route deletes the new one #17014 fixes 2 and 3.
Impact
Major degradation or frequent failure
Version or commit
Client: T3 Code Nightly desktop 0.1.14-nightly.20261127.5359. Hosts: t3 0.1.14-nightly.20261127.5359. Code checked on main a505181.
Environment
macOS arm64 desktop client; two Linux x64 hosts. Reached over Tailscale (direct UDP; MagicDNS HTTPS through Tailscale Serve, and :3773). T3 Connect linked.
Activity
fix(client-runtime,mobile): fallback expired direct/Tailscale bearer …
chore(upstream): absorb v0.1.13 stable fixes and features (324 PRs, 8…