The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 07:00 UTC
fix(client-runtime): connection diagnosis no longer blames the host while this device's sign-in loads (#29352)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 2, 2026 at 11:45 UTC
a821f039c159174b08aab8d1f39b5c8e588d416e
3 files changed
+67
-6
docs/user/t3-connect-troubleshooting.md
+5
-1
@@ -99,7 +99,8 @@ Fix:
99
100
## Sign-in, account, or link problems
101
102
-T3 Connect does not have an active link between your account and the host.
102
+This device's T3 Connect sign-in is not ready yet, or T3 Connect does not have
103
+an active link between your account and the host.
104
105
- **The host is linked to a different account.** Sign in to the same T3 Connect
106
account on this device and on the host. On the host, run `t3 connect logout`,
@@ -111,6 +112,9 @@ T3 Connect does not have an active link between your account and the host.
112
`t3 service restart` on the host, or restart `t3 serve`.
113
- **This device's sign-in expired, or the host no longer accepts this
114
device.** Sign out of T3 Connect and sign in again.
115
+- **This device is still loading its T3 Connect sign-in.** Wait a moment;
116
+ T3 Code retries on its own. If it keeps waiting, reload or restart T3 Code on
117
+ this device.
118
- **Your account reached its tunnel limit.** Remove an environment you do not
119
use from your T3 account's T3 Connect page, or
120
[link a paid T3 Chat account](./remote-access.md#more-machines-with-t3-chat)
packages/client-runtime/src/connection/diagnosis.test.ts
+26
@@ -8,6 +8,8 @@ import { presentConnectionDiagnosis } from "./diagnosis.ts";
8
import { mapManagedRelayError, mapRemoteEnvironmentError } from "./errors.ts";
9
import {
10
AVAILABLE_CONNECTION_STATE,
11
+ ConnectionBlockedError,
12
+ ConnectionTransientError,
13
type ConnectionAttemptError,
14
type SupervisorConnectionState,
15
} from "./model.ts";
@@ -128,6 +130,30 @@ describe("presentConnectionDiagnosis", () => {
130
expect(origin?.hops.map((hop) => hop.hop)).toEqual(["device", "relay", "tunnel", "server"]);
131
});
132
133
+ it("blames this device, not the host, while its own T3 Connect sign-in loads", () => {
134
+ const failure = new ConnectionTransientError({
135
+ reason: "session-pending",
136
+ detail: "Waiting for the T3 Connect sign-in to load.",
137
+ });
138
+ const diagnosis = diagnose(backoff(failure));
139
+ expect(diagnosis?.headline).not.toContain("did not answer");
140
+ expect(diagnosis?.hops.find((hop) => hop.result === "failed")?.hop).toBe("device");
141
+ expect(diagnosis?.steps.join(" ")).not.toContain("Mac mini");
142
+ expect(diagnosis?.moreInfoUrl).toContain("sign-in-account-or-link-problems");
143
+ // A host with a LAN route as well uses the direct route, still authorized through T3 Connect.
144
+ expect(diagnose(backoff(failure), "direct")?.moreInfoUrl).toContain(
145
+ "sign-in-account-or-link-problems",
146
+ );
147
+ });
148
+
149
+ it("does not report hops as working when the failure names none", () => {
150
+ const failure = new ConnectionBlockedError({
151
+ reason: "authentication",
152
+ detail: "Your cloud sign-in changed. Sign in again to authorize the environment.",
153
+ });
154
+ expect(results(backoff(failure))).not.toContainEqual(expect.stringMatching(/:ok$/));
155
+ });
156
+
157
it("keeps the relay health status out of a failure that has its own cause", () => {
158
const failure = mapRemoteEnvironmentError(
159
new RemoteEnvironmentAuthFetchError({ message: "Failed to fetch", cause: new TypeError() }),
packages/client-runtime/src/connection/diagnosis.ts
+36
-5
@@ -26,7 +26,7 @@ export interface ConnectionDiagnosis {
26
readonly hops: ReadonlyArray<ConnectionDiagnosisHop>;
27
readonly steps: ReadonlyArray<string>;
28
readonly facts: ReadonlyArray<readonly [label: string, value: string]>;
29
- /** The troubleshooting guide section for this failure. Null for direct routes. */
29
+ /** The troubleshooting guide section for this failure. Null for direct routes, except a pending T3 Connect sign-in. */
30
readonly moreInfoUrl: string | null;
31
}
32
@@ -46,7 +46,15 @@ export interface ConnectionDiagnosisInput {
46
47
interface Located {
48
readonly hop: ConnectionHop;
49
- readonly cause: ConnectionFailureCause | "offline" | "outdated" | "released" | null;
49
+ readonly cause:
50
+ | ConnectionFailureCause
51
+ | "offline"
52
+ | "outdated"
53
+ | "released"
54
+ | "session_pending"
55
+ | null;
56
+ /** The failure named no hop, so the hops before this one were never probed. */
57
+ readonly guessed?: true;
58
}
59
60
const NOT_ANSWERING: ReadonlySet<ConnectionFailureCause> = new Set([
@@ -62,6 +70,9 @@ function locate(input: ConnectionDiagnosisInput): Located | null {
70
if (failure?._tag === "ConnectionBlockedError" && failure.serverUpdateRequired) {
71
return { hop: "server", cause: "outdated" };
72
}
73
+ if (failure?.reason === "session-pending") {
74
+ return { hop: "device", cause: "session_pending" };
75
+ }
76
if (failure?.hop !== undefined) {
77
return { hop: failure.hop, cause: failure.failureCause ?? null };
78
}
@@ -71,7 +82,11 @@ function locate(input: ConnectionDiagnosisInput): Located | null {
82
failure.reason === "timeout" ||
83
failure.reason === "transport";
84
const via = failure.via ?? input.via;
74
- return { hop: unreachable && via === "relay" ? "tunnel" : "server", cause: null };
85
+ return {
86
+ hop: unreachable && via === "relay" ? "tunnel" : "server",
87
+ cause: null,
88
+ guessed: true,
89
+ };
90
}
91
const status = input.relayStatus;
92
if (status?.status !== "offline") return null;
@@ -84,6 +99,8 @@ function headline(host: string, located: Located, failure: ConnectionAttemptErro
99
switch (located.cause) {
100
case "offline":
101
return "This device is offline";
102
+ case "session_pending":
103
+ return "This device is still loading its T3 Connect sign-in";
104
case "outdated":
105
return `${host} runs an older T3 Code`;
106
case "clock_skew":
@@ -141,6 +158,11 @@ function steps(host: string, located: Located, failure: ConnectionAttemptError |
158
switch (located.cause) {
159
case "offline":
160
return ["Connect this device to the internet. T3 Code reconnects on its own."];
161
+ case "session_pending":
162
+ return [
163
+ "Wait a moment. T3 Code retries on its own.",
164
+ "If it keeps waiting, reload or restart T3 Code on this device.",
165
+ ];
166
case "outdated":
167
return [`Update T3 Code on ${host}.`];
168
case "clock_skew":
@@ -220,6 +242,7 @@ function helpSection(
242
return "the-host-runs-an-older-t3-code";
243
case "clock_skew":
244
return "the-clock-is-off";
245
+ case "session_pending":
246
case "not_linked":
247
case "tunnel_not_enabled":
248
return "sign-in-account-or-link-problems";
@@ -300,7 +323,12 @@ export function presentConnectionDiagnosis(
323
const hops = order.map((hop, index): ConnectionDiagnosisHop => ({
324
hop,
325
label: hopLabel(hop, host),
303
- result: index < failedIndex ? "ok" : index === failedIndex ? "failed" : "unchecked",
326
+ result:
327
+ index === failedIndex
328
+ ? "failed"
329
+ : index < failedIndex && located.guessed !== true
330
+ ? "ok"
331
+ : "unchecked",
332
}));
333
334
// The relay health check only explains the state when no attempt has failed yet.
@@ -329,7 +357,10 @@ export function presentConnectionDiagnosis(
357
hops,
358
steps: steps(host, located, failure),
359
facts,
332
- moreInfoUrl: relayPath ? t3ConnectTroubleshootingUrl(helpSection(located, failure)) : null,
360
+ moreInfoUrl:
361
+ relayPath || located.cause === "session_pending"
362
+ ? t3ConnectTroubleshootingUrl(helpSection(located, failure))
363
+ : null,
364
};
365
}
366