The best way to control Claude Code, Codex and more from any computer or phone
fix(cli): t3 pair's no-running-server hint keeps --base-dir (#30689)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Alex Southwell committed
Nov 6, 2026 at 04:34 UTC
6f96d0ea08263cb2b9aa4294e27d05481c07eef4
2 files changed
+19
-4
apps/server/src/cli/pair.test.ts
+6
-1
@@ -34,6 +34,7 @@ import {
34
persistServerRuntimeState,
35
type PersistedServerRuntimeState,
36
} from "../serverRuntimeState.ts";
37
+import { resolveHostCliCommand } from "./invocation.ts";
38
import { DevServerNotProxiableError, resolveTailscaleLocalTarget } from "./pair.ts";
39
40
import packageJson from "../../package.json" with { type: "json" };
@@ -315,7 +316,7 @@ describe("t3 pair", () => {
316
it.effect("ignores runtime state whose recorded pid is no longer alive", () =>
317
withDescriptorServer((origin) =>
318
Effect.gen(function* () {
318
- const baseDir = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-pair-pid-test-"));
319
+ const baseDir = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3 pair pid test-"));
320
const statePath = NodePath.join(baseDir, "userdata", "server-runtime.json");
321
const state = yield* makePersistedServerRuntimeState({
322
config: { host: "127.0.0.1", devUrl: undefined },
@@ -334,6 +335,10 @@ describe("t3 pair", () => {
335
typeof error === "object" && error !== null && "cause" in error ? error.cause : error,
336
);
337
assert.include(rendered, "No running T3 Code server found.");
338
+ for (const subcommand of ["serve", "connect"]) {
339
+ const { command } = yield* resolveHostCliCommand(subcommand, ["--base-dir", baseDir]);
340
+ assert.include(rendered, `\`${command}\``);
341
+ }
342
}),
343
).pipe(Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
344
);
apps/server/src/cli/pair.ts
+13
-3
@@ -48,6 +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";
52
53
const WELL_KNOWN_ENVIRONMENT_PATH = "/.well-known/t3/environment";
54
const PAIR_PROBE_TIMEOUT = Duration.millis(2_500);
@@ -65,6 +66,8 @@ export class NoRunningServerError extends Schema.TaggedError<NoRunningServerErro
66
{
67
checkedStatePaths: Schema.Array(Schema.String),
68
inLinkedWorktree: Schema.Boolean,
69
+ serveCommand: Schema.String,
70
+ connectCommand: Schema.String,
71
},
72
) {
73
override get message(): string {
@@ -74,7 +77,7 @@ export class NoRunningServerError extends Schema.TaggedError<NoRunningServerErro
77
...(this.inLinkedWorktree
78
? ["In a linked worktree, pass --base-dir to pair with a server outside it."]
79
: []),
77
- "Start one with `npx t3 serve`, or connect this machine with T3 Connect: `npx t3 connect`.",
80
+ `Start one with \`${this.serveCommand}\`, or connect this machine with T3 Connect: \`${this.connectCommand}\`.`,
81
].join("\n");
82
}
83
}
@@ -245,7 +248,8 @@ const discoverPairTarget = Effect.fn("pair.discoverPairTarget")(function* (
248
) {
249
const bases: Array<string> = [];
250
let inLinkedWorktree = false;
248
- if (explicitBaseDir !== undefined && explicitBaseDir.trim().length > 0) {
251
+ const hasExplicitBaseDir = explicitBaseDir !== undefined && explicitBaseDir.trim().length > 0;
252
+ if (hasExplicitBaseDir) {
253
bases.push(yield* resolveBaseDir(explicitBaseDir));
254
} else {
255
// Same precedence as dev-runner: inside a linked worktree only its own
@@ -292,7 +296,13 @@ const discoverPairTarget = Effect.fn("pair.discoverPairTarget")(function* (
296
} satisfies DiscoveredPairTarget;
297
}
298
}
295
- return yield* new NoRunningServerError({ checkedStatePaths, inLinkedWorktree });
299
+ const baseDirArgs = hasExplicitBaseDir ? ["--base-dir", explicitBaseDir] : [];
300
+ return yield* new NoRunningServerError({
301
+ checkedStatePaths,
302
+ inLinkedWorktree,
303
+ serveCommand: (yield* resolveHostCliCommand("serve", baseDirArgs)).command,
304
+ connectCommand: (yield* resolveHostCliCommand("connect", baseDirArgs)).command,
305
+ });
306
});
307
308
/** Use the discovered state directory, independent of ambient config variables. */