@@ -20,7 +20,6 @@ export class ServiceLauncherClientError extends Schema.TaggedError<ServiceLaunch
2020 operation : Schema . Literals ( [
2121 "decode-context" ,
2222 "version-mismatch" ,
23- "ipc-unavailable" ,
2423 "unmanaged" ,
2524 "send" ,
2625 "disconnect" ,
@@ -35,8 +34,6 @@ export class ServiceLauncherClientError extends Schema.TaggedError<ServiceLaunch
3534 return "The service launcher supplied invalid startup context." ;
3635 case "version-mismatch" :
3736 return "The service launcher started a different t3 version." ;
38- case "ipc-unavailable" :
39- return "The service launcher IPC channel is unavailable." ;
4037 case "unmanaged" :
4138 return "This server is not managed by the launcher." ;
4239 case "send" :
@@ -116,7 +113,10 @@ const resolveStartup = Effect.fn("cloud.service_launcher_client.resolve_startup"
116113 const host = yield * ServiceLauncherHostProcess ;
117114 const environment = yield * HostProcess . Environment ;
118115 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 ;
120120 const context = rawContext === undefined ? undefined : decodeServiceLauncherContext ( rawContext ) ;
121121
122122 if ( rawContext !== undefined && context === undefined ) {
@@ -126,10 +126,7 @@ const resolveStartup = Effect.fn("cloud.service_launcher_client.resolve_startup"
126126 return yield * new ServiceLauncherClientError ( { operation : "version-mismatch" } ) ;
127127 }
128128
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 ;
133130
134131 return { host, context, managed } ;
135132 } ,
0 commit comments