The best way to control Claude Code, Codex and more from any computer or phone
fix(server): browser setup command names the running t3 executable, not another t3 on PATH (#34936)
Julius Marminge committed
Nov 12, 2026 at 00:07 UTC
b63b559c053a7ba237987b501061ae4b93ae79f1
2 files changed
+42
-2
apps/server/src/cli/invocation.test.ts
+31
@@ -109,6 +109,37 @@ it.layer(NodeServices.layer)("root CLI commands", (it) => {
109
}),
110
).toBe("sudo /opt/t3/t3 browser setup");
111
112
+ // A standalone executable started directly (systemd, no launcher) is still this install.
113
+ expect(
114
+ yield* rootCommand({
115
+ node: "/opt/t3/t3",
116
+ entry: "/opt/t3/t3",
117
+ executable: true,
118
+ path: yield* pathWithT3,
119
+ }),
120
+ ).toBe("sudo /opt/t3/t3 browser setup");
121
+
122
+ // A global npm launcher runs the downloaded executable; PATH's `t3` is that launcher.
123
+ const prefix = path.join(home, "npm");
124
+ const npmLauncher = path.join(prefix, "lib/node_modules/t3/bin/t3.mjs");
125
+ yield* fs.makeDirectory(path.dirname(npmLauncher), { recursive: true });
126
+ yield* fs.makeDirectory(path.join(prefix, "bin"));
127
+ yield* fs.writeFileString(npmLauncher, "", { mode: 0o755 });
128
+ yield* fs.writeFileString(
129
+ path.join(prefix, "lib/node_modules/t3/package.json"),
130
+ `{"name":"t3","version":"${packageJson.version}"}`,
131
+ );
132
+ yield* fs.symlink(npmLauncher, path.join(prefix, "bin/t3"));
133
+ expect(
134
+ yield* rootCommand({
135
+ node: "/home/theo/.t3/runtime/versions/1.0.0/t3",
136
+ entry: "/home/theo/.t3/runtime/versions/1.0.0/t3",
137
+ executable: true,
138
+ path: path.join(prefix, "bin"),
139
+ env: { T3CODE_NPM_LAUNCHER_PATH: npmLauncher },
140
+ }),
141
+ ).toBe('sudo env "PATH=$PATH" t3 browser setup');
142
+
143
expect(
144
yield* rootCommand({ ...desktop, env: { T3CODE_CLI_PATH: path.join(home, "gone") } }),
145
).toBe('sudo env "PATH=$PATH" t3 browser setup');
apps/server/src/cli/invocation.ts
+11
-2
@@ -160,8 +160,17 @@ export const resolveHostCliCommand = Effect.fn("invocation.resolveHostCliCommand
160
const shim = (yield* HostProcess.Environment).T3CODE_CLI_PATH?.trim();
161
const fs = yield* FileSystem.FileSystem;
162
const real = (file: string) => fs.realPath(file).pipe(Effect.orElseSucceed(() => null));
163
- const shimReal = shim ? yield* real(shim) : null;
164
- if (shimReal === null || shimReal === (yield* real(onPath))) {
163
+ // Windows `t3.cmd` shims are text files that never realpath to the executable they run.
164
+ const own = shim
165
+ ? yield* real(shim)
166
+ : platform !== "win32" && (yield* HostProcess.IsExecutable)
167
+ ? yield* resolveEntryPath.pipe(
168
+ Effect.flatMap((entry) =>
169
+ real(entry).pipe(Effect.map((resolved) => resolved ?? entry)),
170
+ ),
171
+ )
172
+ : null;
173
+ if (own === null || own === (yield* real(onPath))) {
174
return { command: withArgs(command), launcher: false };
175
}
176
}