@@ -580,6 +580,38 @@ it.layer(layerTest)("CodexDriver", (it) => {
580580 } ) . pipe ( Effect . provideService ( ChildProcessSpawner . ChildProcessSpawner , noSpawn ) , Effect . scoped ) ,
581581 ) ;
582582
583+ it . effect . skipIf ( windowsHost ) (
584+ "shares state from the environment CODEX_HOME in a shadow home" ,
585+ ( ) =>
586+ Effect . gen ( function * ( ) {
587+ const fs = yield * FileSystem . FileSystem ;
588+ const tempDir = yield * fs
589+ . makeTempDirectoryScoped ( { prefix : "t3-codex-driver-" } )
590+ . pipe ( Effect . flatMap ( ( directory ) => fs . realPath ( directory ) ) ) ;
591+ const codexHome = NodePath . join ( tempDir , "custom-codex" ) ;
592+ const shadowHome = NodePath . join ( tempDir , "shadow" ) ;
593+ yield * fs . makeDirectory ( codexHome , { recursive : true } ) ;
594+ yield * fs . writeFileString ( NodePath . join ( codexHome , "config.toml" ) , 'model = "custom"\n' ) ;
595+ const instance = yield * CodexDriver . create ( {
596+ instanceId : ProviderInstanceId . make ( "env-shadow" ) ,
597+ displayName : "env-shadow" ,
598+ enabled : false ,
599+ environment : [ { name : "CODEX_HOME" , value : codexHome , sensitive : false } ] ,
600+ config : { ...CodexDriver . defaultConfig ( ) , shadowHomePath : shadowHome } ,
601+ } ) . pipe ( Effect . provideService ( HostProcess . HomeDirectory , NodePath . join ( tempDir , "user" ) ) ) ;
602+ expect ( instance . continuationIdentity . continuationKey ) . toBe ( `codex:home:${ codexHome } ` ) ;
603+ expect ( yield * fs . readLink ( NodePath . join ( shadowHome , "config.toml" ) ) ) . toBe (
604+ NodePath . join ( codexHome , "config.toml" ) ,
605+ ) ;
606+ expect ( yield * fs . readLink ( NodePath . join ( shadowHome , "sessions" ) ) ) . toBe (
607+ NodePath . join ( codexHome , "sessions" ) ,
608+ ) ;
609+ } ) . pipe (
610+ Effect . provideService ( ChildProcessSpawner . ChildProcessSpawner , noSpawn ) ,
611+ Effect . scoped ,
612+ ) ,
613+ ) ;
614+
583615 for ( const fixture of [
584616 {
585617 name : "leaves mise npm-backend installations manual-only" ,
0 commit comments