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 21, 18:30 UTC
fix(cli): t3 pair's protocol mismatch hint keeps --base-dir (#35690)
Julius Marminge committed
Nov 12, 2026 at 15:59 UTC
bb26e569adff5a176f026ed631e5f33e49fb25fa
3 files changed
+20
-6
apps/server/src/cli/invocation.ts
+1
-1
@@ -145,7 +145,7 @@ const powershellWord = (value: string) =>
145
.replaceAll("$", "`$")
146
.replace(/["\u201C\u201D\u201E]/g, "$&$&")}"`;
147
148
-const hostShellWord = (platform: NodeJS.Platform, value: string) =>
148
+export const hostShellWord = (platform: NodeJS.Platform, value: string) =>
149
platform === "win32" ? powershellWord(value) : shellWord(value);
150
151
/** Script installs have no single launcher; desktop shims and standalone binaries do. */
apps/server/src/cli/pair.test.ts
+4
-1
@@ -495,7 +495,10 @@ describe("t3 pair", () => {
495
]);
496
assert.isTrue(Exit.isFailure(exit));
497
if (Exit.isFailure(exit)) {
498
- assert.include(String(Cause.squash(exit.cause)), "t3@0.0.45 pair");
498
+ assert.include(
499
+ String(Cause.squash(exit.cause)),
500
+ `t3@0.0.45 pair --base-dir ${baseDir}`,
501
+ );
502
}
503
}),
504
"127.0.0.1",
apps/server/src/cli/pair.ts
+15
-4
@@ -48,7 +48,7 @@ import {
48
} from "../startupAccess.ts";
49
import { authScopesFlag } from "./authScopes.ts";
50
import { baseDirFlag, DurationFromString } from "./config.ts";
51
-import { resolveHostCliCommand } from "./invocation.ts";
51
+import { hostShellWord, resolveHostCliCommand } from "./invocation.ts";
52
53
const WELL_KNOWN_ENVIRONMENT_PATH = "/.well-known/t3/environment";
54
const PAIR_PROBE_TIMEOUT = Duration.millis(2_500);
@@ -84,12 +84,16 @@ export class NoRunningServerError extends Schema.TaggedError<NoRunningServerErro
84
85
export class IncompatibleServerProtocolError extends Schema.TaggedError<IncompatibleServerProtocolError>()(
86
"IncompatibleServerProtocolError",
87
- { serverVersion: Schema.String, serverProtocolVersion: Schema.Number },
87
+ {
88
+ serverVersion: Schema.String,
89
+ serverProtocolVersion: Schema.Number,
90
+ pairCommand: Schema.String,
91
+ },
92
) {
93
override get message(): string {
94
return [
95
`The running T3 Code server (${this.serverVersion}) speaks orchestration protocol ${String(this.serverProtocolVersion)}, but this CLI speaks protocol ${String(ORCHESTRATION_PROTOCOL_VERSION)}.`,
92
- `Pair with the matching CLI instead: \`npx t3@${this.serverVersion} pair\`.`,
96
+ `Pair with the matching CLI instead: \`${this.pairCommand}\`.`,
97
].join("\n");
98
}
99
}
@@ -521,15 +525,22 @@ export const pairCommand = Command.make("pair", {
525
const cliLogLevel = yield* GlobalFlag.LogLevel;
526
const logLevel = Option.getOrElse(cliLogLevel, () => "Warn" as const);
527
524
- const target = yield* discoverPairTarget(Option.getOrUndefined(flags.baseDir));
528
+ const explicitBaseDir = Option.getOrUndefined(flags.baseDir);
529
+ const target = yield* discoverPairTarget(explicitBaseDir);
530
// Each protocol keeps auth in its own database, so a token minted here
531
// for another protocol's server would never be accepted by it. Refuse
532
// before any local layer opens (and migrates) that database.
533
const serverProtocolVersion = target.descriptor.orchestrationProtocolVersion ?? 1;
534
if (serverProtocolVersion !== ORCHESTRATION_PROTOCOL_VERSION) {
535
+ const platform = yield* HostProcess.Platform;
536
+ const baseDirArgs =
537
+ explicitBaseDir !== undefined && explicitBaseDir.trim().length > 0
538
+ ? ` --base-dir ${hostShellWord(platform, explicitBaseDir)}`
539
+ : "";
540
return yield* new IncompatibleServerProtocolError({
541
serverVersion: target.descriptor.serverVersion,
542
serverProtocolVersion,
543
+ pairCommand: `npx t3@${target.descriptor.serverVersion} pair${baseDirArgs}`,
544
});
545
}
546