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, 05:45 UTC
fix(server): T3 Connect not-linked fix no longer tells Desktop users to run t3 service restart (#27660)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 2, 2026 at 18:31 UTC
607e373e50a7a03fa7d37b6b313225eec5660f4b
5 files changed
+75
-5
apps/server/src/cloud/CloudLink.lifecycle.test.ts
+55
-1
@@ -140,6 +140,7 @@ describe("releaseManagedTunnelOnShutdown", () => {
140
readonly address?: HttpServer.HttpServer["Service"]["address"];
141
readonly respondEffect?: Effect.Effect<Response>;
142
readonly getExisting?: CliTokenManager.CloudCliTokenManager["Service"]["getExisting"];
143
+ readonly latestReachability?: ConnectReachability.ConnectReachability["Service"]["latest"];
144
}
145
146
const writeLauncherState = (update: ServiceUpdateRecord) =>
@@ -165,7 +166,7 @@ describe("releaseManagedTunnelOnShutdown", () => {
166
ConnectReachability.ConnectReachability,
167
ConnectReachability.ConnectReachability.of({
168
check: Effect.die("unused"),
168
- latest: Effect.succeedNone,
169
+ latest: harness.latestReachability ?? Effect.succeedNone,
170
}),
171
),
172
Effect.provideService(HttpServer.HttpServer, {
@@ -1050,4 +1051,57 @@ describe("releaseManagedTunnelOnShutdown", () => {
1051
expect(values.has(CLOUD_ENDPOINT_RUNTIME_CONFIG)).toBe(false);
1052
}).pipe(provideReleaseHarness({ store: failingStore, applyConfigCalls, requests }));
1053
});
1054
+
1055
+ it.effect("does not report a not-linked check once the managed tunnel config is stored", () => {
1056
+ const { store } = makeMemorySecretStore(managedLinkSecrets);
1057
+ const notLinked = ConnectReachability.classifyReachability(
1058
+ {
1059
+ managedTunnelConfigured: false,
1060
+ connector: null,
1061
+ endpoint: null,
1062
+ edgeReachable: null,
1063
+ exitNode: null,
1064
+ },
1065
+ "2026-10-29T00:00:00.000Z",
1066
+ );
1067
+
1068
+ return Effect.gen(function* () {
1069
+ const state = yield* (yield* CloudLink.CloudLink).linkState();
1070
+
1071
+ expect(state.managedTunnelActive).toBe(true);
1072
+ expect(state.reachability?.status === "unreachable" && state.reachability.cause).not.toBe(
1073
+ "not_linked",
1074
+ );
1075
+ }).pipe(
1076
+ provideReleaseHarness({
1077
+ store,
1078
+ applyConfigCalls: [],
1079
+ requests: [],
1080
+ latestReachability: Effect.succeedSome(notLinked),
1081
+ }),
1082
+ );
1083
+ });
1084
+
1085
+ it.effect("reports a check that ran after the managed tunnel config was stored", () => {
1086
+ const { store } = makeMemorySecretStore(managedLinkSecrets);
1087
+ const reachable = {
1088
+ status: "reachable" as const,
1089
+ checkedAt: "2026-10-29T00:00:00.000Z",
1090
+ readyConnections: 4,
1091
+ protocol: "quic",
1092
+ };
1093
+
1094
+ return Effect.gen(function* () {
1095
+ const state = yield* (yield* CloudLink.CloudLink).linkState();
1096
+
1097
+ expect(state.reachability).toEqual(reachable);
1098
+ }).pipe(
1099
+ provideReleaseHarness({
1100
+ store,
1101
+ applyConfigCalls: [],
1102
+ requests: [],
1103
+ latestReachability: Effect.succeedSome(reachable),
1104
+ }),
1105
+ );
1106
+ });
1107
});
apps/server/src/cloud/CloudLink.ts
+8
-1
@@ -1290,6 +1290,13 @@ const make = Effect.gen(function* () {
1290
],
1291
{ concurrency: 8 },
1292
);
1293
+ // A not-linked check predates the stored tunnel config; the next check replaces it.
1294
+ const currentReachability = Option.filter(
1295
+ latestReachability,
1296
+ (result) =>
1297
+ Option.isNone(endpointRuntimeConfig) ||
1298
+ !(result.status === "unreachable" && result.cause === "not_linked"),
1299
+ );
1300
return {
1301
linked: Option.isSome(cloudUserId),
1302
linkRevoked: Option.isSome(cloudUserId) && Option.isSome(revoked),
@@ -1302,7 +1309,7 @@ const make = Effect.gen(function* () {
1309
: false,
1310
holdWebhooksWhileOffline:
1311
Option.isSome(holdWebhooks) && bytesToString(holdWebhooks.value) === "true",
1305
- ...(Option.isSome(latestReachability) ? { reachability: latestReachability.value } : {}),
1312
+ ...(Option.isSome(currentReachability) ? { reachability: currentReachability.value } : {}),
1313
} satisfies EnvironmentCloudLinkStateResult;
1314
});
1315
apps/server/src/cloud/ConnectReachability.test.ts
+7
@@ -65,6 +65,13 @@ describe("classifyReachability", () => {
65
classifyReachability(facts({ connector: notConnected, edgeReachable: true }), checkedAt),
66
).toMatchObject({ cause: "connector_not_ready" });
67
});
68
+
69
+ it("does not point an unlinked server at a background service it may not have", () => {
70
+ // Desktop and `t3 serve` run the server without a background service.
71
+ const result = classifyReachability(facts({ managedTunnelConfigured: false }), checkedAt);
72
+ expect(result).toMatchObject({ cause: "not_linked" });
73
+ expect(result.status === "unreachable" && result.fix).not.toContain("t3 service");
74
+ });
75
});
76
77
describe("T3 Connect troubleshooting links", () => {
apps/server/src/cloud/ConnectReachability.ts
+2
-1
@@ -68,10 +68,11 @@ export function classifyReachability(
68
const restart = "Restart T3 Code. If it stays, run `t3 connect` again.";
69
70
if (!facts.managedTunnelConfigured) {
71
+ // A running server reads the link `t3 connect` stores only at startup.
72
return fail(
73
"not_linked",
74
"The server has not set up a T3 Connect tunnel.",
74
- "Run `t3 connect`, then restart the server (`t3 service restart`) so it applies the link.",
75
+ "Run `t3 connect`, then restart T3 Code so it applies the link.",
76
);
77
}
78
if (connector === null) {
docs/user/t3-connect-troubleshooting.md
+3
-2
@@ -108,8 +108,9 @@ an active link between your account and the host.
108
- **T3 Connect is off on the host, or the host only publishes agent activity.**
109
On the host, open **Settings > Sharing & access** and turn **T3 Connect** on, or
110
run `t3 connect`.
111
-- **The host was linked, but the server did not apply the link yet.** Run
112
- `t3 service restart` on the host, or restart `t3 serve`.
111
+- **The host was linked, but the server did not apply the link yet.** Restart
112
+ the server on the host: quit and reopen the T3 Code desktop app, run
113
+ `t3 service restart`, or stop `t3 serve` and run it again.
114
- **This device's sign-in expired, or the host no longer accepts this
115
device.** Sign out of T3 Connect and sign in again.
116
- **This device is still loading its T3 Connect sign-in.** Wait a moment;