Skip to content

Commit dd9793b

Browse files
fix(server): name exact recovery steps when a stale CLI blocks the service
A blocked launcher preflight only said to update the launcher, so a user whose PATH resolved an old npm/nvm `t3` kept running `t3 service update`, which reinstalled that same stale CLI and reported success. The preflight reason now names the offered and required launcher protocols, the exact-version installer command, `t3 --version` and `which -a t3` to spot a shadowed CLI, and the installer's default `~/.local/bin/t3 service install`. It also says a desktop app update does not update the CLI. `t3 service install`/`update` no-op lines now name the CLI entry script or executable that ran. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 0e141f4 commit dd9793b

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

‎apps/server/src/cli/invocation.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const decodeInstallManifest = Schema.decodeUnknownEffect(Schema.fromJsonString(I
4848
* counts only when its package is this exact version: a different `t3` run
4949
* from an agent's shell must not claim to be the npm install.
5050
*/
51-
const resolveEntryPath = Effect.gen(function* () {
51+
export const resolveEntryPath = Effect.gen(function* () {
5252
const npmLauncher = (yield* HostProcess.Environment).T3CODE_NPM_LAUNCHER_PATH?.trim();
5353
if (npmLauncher) {
5454
const fs = yield* FileSystem.FileSystem;

‎apps/server/src/cli/service.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { compareExactServiceVersions } from "../cloud/serviceProtocol.ts";
1212
import type * as ServerConfig from "../config.ts";
1313
import * as ProcessRunner from "../processRunner.ts";
1414
import { projectLocationFlags, resolveCliAuthConfig } from "./config.ts";
15+
import { resolveEntryPath } from "./invocation.ts";
1516

1617
export const layer = (config: ServerConfig.ServerConfig["Service"]) =>
1718
BootService.layer({
@@ -102,9 +103,9 @@ function formatServiceStatus(status: BootService.BootServiceStatus, cliVersion:
102103
].join("\n");
103104
}
104105

105-
const runServiceCommand = Effect.fn("cli.service.run")(function* <A, E>(
106+
const runServiceCommand = Effect.fn("cli.service.run")(function* <A, E, R>(
106107
flags: { readonly baseDir: Parameters<typeof resolveCliAuthConfig>[0]["baseDir"] },
107-
run: Effect.Effect<A, E, BootService.BootService>,
108+
run: Effect.Effect<A, E, R>,
108109
) {
109110
const logLevel = yield* GlobalFlag.LogLevel;
110111
const config = yield* resolveCliAuthConfig(flags, logLevel);
@@ -128,7 +129,7 @@ const serviceInstallCommand = Command.make("install", serviceReconcileFlags).pip
128129
const result = yield* reconcileService({ allowDowngrade: flags.allowDowngrade });
129130
if (!result.changed) {
130131
yield* Console.log(
131-
`T3 Code service is already installed with t3@${packageJson.version}.`,
132+
`T3 Code service is already installed with t3@${packageJson.version} (${yield* resolveEntryPath}).`,
132133
);
133134
return;
134135
}
@@ -150,7 +151,9 @@ const serviceUpdateCommand = Command.make("update", serviceReconcileFlags).pipe(
150151
);
151152
const result = yield* reconcileService({ allowDowngrade: flags.allowDowngrade });
152153
if (!result.changed) {
153-
yield* Console.log(`T3 Code service is already using t3@${packageJson.version}.`);
154+
yield* Console.log(
155+
`T3 Code service is already using t3@${packageJson.version} (${yield* resolveEntryPath}).`,
156+
);
154157
return;
155158
}
156159
yield* Console.log(formatServiceChange(result));

‎apps/server/src/cloud/servicePreflight.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,14 @@ export function runServicePreflight(input: {
2323
return {
2424
status: "blocked",
2525
version,
26-
reason:
27-
"This release requires a newer T3 Code service launcher. Update it on the server machine.",
26+
// A stale `t3` earlier on PATH (an old npm/nvm global) makes `t3 service install`
27+
// reinstall itself and report success, so name the exact install and the path check.
28+
reason: [
29+
`The installed service launcher speaks protocol ${input.launcherProtocol}, but t3@${version} requires protocol ${SERVICE_LAUNCHER_PROTOCOL}.`,
30+
`On the server machine, install this exact CLI: \`curl -fsSL https://t3.codes/install.sh | T3CODE_VERSION=${version} sh\`.`,
31+
`Check that \`t3 --version\` prints ${version} and that \`which -a t3\` lists no older t3 (such as an npm or nvm install) first, then run \`~/.local/bin/t3 service install\` (the installer's default path).`,
32+
"Updating the desktop app does not update this CLI, and `t3 service update` only repairs the service with whichever CLI runs it.",
33+
].join(" "),
2834
};
2935
}
3036

0 commit comments

Comments
 (0)