@@ -572,12 +572,7 @@ export const make = Effect.fn("cloud.boot_service.make")(function* (input: {
572572 const statePath = path . join ( input . baseDir , "runtime" , SERVICE_STATE_FILE ) ;
573573 const restartPendingPath = path . join ( input . baseDir , "runtime" , SERVICE_RESTART_PENDING_FILE ) ;
574574 const runtimePaths = pinnedRuntimePaths ( path , input . baseDir , input . cliVersion , platform ) ;
575- // macOS keys Full Disk Access and Files & Folders grants for a non-bundled
576- // executable to its absolute path, and the launch agent's process is the
577- // responsible process for everything it spawns. Running the launcher from
578- // a versioned directory made every update lose those grants, so on macOS
579- // the launch agent runs a copy of the runtime at a path no update changes.
580- // The copy still spawns `versions/<activeVersion>/t3 serve` as before.
575+ // macOS privacy grants track the launchd parent's executable path across updates.
581576 const launcherDir = path . join ( input . baseDir , "runtime" , SERVICE_LAUNCHER_DIR ) ;
582577 const launcher =
583578 platform === "darwin"
@@ -608,8 +603,6 @@ export const make = Effect.fn("cloud.boot_service.make")(function* (input: {
608603 ) ;
609604 } ) ,
610605 ) . pipe ( Effect . mapError ( ( cause ) => new BootServiceInstallError ( { cause } ) ) ) ;
611- // The executable hosts the launcher as a hidden subcommand of itself, so
612- // the unit runs the pinned runtime (or, on macOS, its fixed-path copy) directly.
613606 const plan : BootServicePlan = {
614607 program : [ launcher ?. entryPath ?? runtimePaths . entryPath , "__service-launcher" ] ,
615608 baseDir : input . baseDir ,
@@ -728,21 +721,17 @@ export const make = Effect.fn("cloud.boot_service.make")(function* (input: {
728721 if ( remaining [ 0 ] ) return yield * new BootServicePrerequisiteError ( { problem : remaining [ 0 ] } ) ;
729722 } ) ;
730723
731- const launcherComplete = ( directory : string ) =>
732- Effect . all ( [
733- fs . exists ( path . join ( directory , path . basename ( runtimePaths . entryPath ) ) ) ,
734- fs
735- . readFileString ( path . join ( directory , path . basename ( runtimePaths . sentinelPath ) ) )
736- . pipe (
737- Effect . catch ( ( error ) =>
738- error . reason . _tag === "NotFound" ? Effect . succeed ( "" ) : Effect . fail ( error ) ,
739- ) ,
740- ) ,
741- ] ) . pipe (
742- Effect . map (
743- ( [ entryExists , sentinel ] ) => entryExists && isExactServiceVersion ( sentinel . trim ( ) ) ,
744- ) ,
724+ const launcherComplete = Effect . fn ( "cloud.boot_service.launcher_complete" ) ( function * (
725+ directory : string ,
726+ ) {
727+ const entryExists = yield * fs . exists (
728+ path . join ( directory , path . basename ( runtimePaths . entryPath ) ) ,
745729 ) ;
730+ const sentinel = yield * fs
731+ . readFileString ( path . join ( directory , path . basename ( runtimePaths . sentinelPath ) ) )
732+ . pipe ( Effect . catchReason ( "PlatformError" , "NotFound" , ( ) => Effect . succeed ( "" ) ) ) ;
733+ return entryExists && isExactServiceVersion ( sentinel . trim ( ) ) ;
734+ } ) ;
746735 const recoverLauncher = Effect . suspend ( ( ) =>
747736 launcher === undefined
748737 ? Effect . void
@@ -780,11 +769,7 @@ export const make = Effect.fn("cloud.boot_service.make")(function* (input: {
780769 yield * fs . copy ( runtimePaths . sentinelPath , path . join ( launcher . stagingDir , sentinel ) ) ;
781770 } ) ,
782771 ) . pipe ( Effect . mapError ( ( cause ) => new BootServiceInstallError ( { cause } ) ) ) ;
783- // Renames, never overwrites: a launcher that is still running keeps its
784- // open executable. The fixed path holds a complete copy except for the
785- // moment between the two renames; a failed swap puts the previous copy
786- // back. Once the new copy is in place, a retired copy that cannot be
787- // removed is left for the next install to clear.
772+ // Rename instead of overwriting a running executable; keep recovery copies if rollback fails.
788773 const publishLauncher = Effect . suspend ( ( ) =>
789774 launcher === undefined
790775 ? Effect . void
0 commit comments