@devries-cameron20 / t3code-1 / commits / 1b5c2d1d30
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): t3 run from a T3 terminal no longer trips on the service's launcher context (#14263)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Shawn committed Oct 18, 2026 at 15:31 UTC 1b5c2d1d300a72845df5e45878daae44c94b4d87
2 files changed +23 -10
apps/server/src/cloud/serviceLauncherClient.test.ts
+18 -2
@@ -12,12 +12,13 @@ import {
12 import * as ServiceLauncherClient from "./serviceLauncherClient.ts";
13
14 class FakeLauncherProcess {
15 - readonly connected = true;
15 + readonly connected: boolean;
16 readonly env: Record<string, string | undefined>;
17 readonly sent: ServiceLauncherChildMessage[] = [];
18 readonly #listeners = new Map<string, Set<(...args: ReadonlyArray<unknown>) => void>>();
19
20 - constructor(context: unknown) {
20 + constructor(context: unknown, connected = true) {
21 + this.connected = connected;
22 this.env = { [SERVICE_LAUNCHER_CONTEXT_ENV]: JSON.stringify(context) };
23 }
24
@@ -136,3 +137,18 @@ it.effect("rejects contradictory trial context instead of leaving activation clo
137 expect(error.message).toBe("The service launcher supplied invalid startup context.");
138 }),
139 );
140 +
141 +it.effect("ignores launcher context inherited without an IPC channel", () =>
142 + Effect.gen(function* () {
143 + const host = new FakeLauncherProcess(
144 + { protocol: SERVICE_LAUNCHER_PROTOCOL, childVersion: "1.0.0" },
145 + false,
146 + );
147 + const client = yield* makeClient(host, "1.1.0");
148 + const error = yield* client
149 + .requestUpdate({ targetVersion: "1.2.0", dbPath: "/tmp/state.sqlite" })
150 + .pipe(Effect.flip);
151 + expect(error).toMatchObject({ _tag: "ServiceLauncherClientError", operation: "unmanaged" });
152 + expect(host.sent).toEqual([]);
153 + }),
154 +);
apps/server/src/cloud/serviceLauncherClient.ts
+5 -8
@@ -20,7 +20,6 @@ export class ServiceLauncherClientError extends Schema.TaggedError<ServiceLaunch
20 operation: Schema.Literals([
21 "decode-context",
22 "version-mismatch",
23 - "ipc-unavailable",
23 "unmanaged",
24 "send",
25 "disconnect",
@@ -35,8 +34,6 @@ export class ServiceLauncherClientError extends Schema.TaggedError<ServiceLaunch
34 return "The service launcher supplied invalid startup context.";
35 case "version-mismatch":
36 return "The service launcher started a different t3 version.";
38 - case "ipc-unavailable":
39 - return "The service launcher IPC channel is unavailable.";
37 case "unmanaged":
38 return "This server is not managed by the launcher.";
39 case "send":
@@ -116,7 +113,10 @@ const resolveStartup = Effect.fn("cloud.service_launcher_client.resolve_startup"
113 const host = yield* ServiceLauncherHostProcess;
114 const environment = yield* HostProcess.Environment;
115 const currentVersion = options?.currentVersion ?? packageJson.version;
119 - const rawContext = environment[SERVICE_LAUNCHER_CONTEXT_ENV];
116 + // The launcher always spawns its child with an IPC channel, and Node does
117 + // not pass that channel on. Without one, the context was inherited from an
118 + // ancestor (e.g. `t3 serve` run in a T3 terminal), so it describes someone else.
119 + const rawContext = host.connected ? environment[SERVICE_LAUNCHER_CONTEXT_ENV] : undefined;
120 const context = rawContext === undefined ? undefined : decodeServiceLauncherContext(rawContext);
121
122 if (rawContext !== undefined && context === undefined) {
@@ -126,10 +126,7 @@ const resolveStartup = Effect.fn("cloud.service_launcher_client.resolve_startup"
126 return yield* new ServiceLauncherClientError({ operation: "version-mismatch" });
127 }
128
129 - const managed = context !== undefined && host.connected;
130 - if (context !== undefined && !managed) {
131 - return yield* new ServiceLauncherClientError({ operation: "ipc-unavailable" });
132 - }
129 + const managed = context !== undefined;
130
131 return { host, context, managed };
132 },