@@ -165,6 +165,61 @@ it.layer(NodeServices.layer)("CodexHomeLayout", (it) => {
165165 } ) ,
166166 ) ;
167167
168+ it . effect . skipIf ( ! symlinksSupported ) (
169+ "keeps originator-partitioned models cache files private to each home" ,
170+ ( ) =>
171+ Effect . gen ( function * ( ) {
172+ const fileSystem = yield * FileSystem . FileSystem ;
173+ const path = yield * Path . Path ;
174+ const sharedHome = yield * makeTempDir ( "t3code-codex-shared-" ) ;
175+ const shadowRoot = yield * makeTempDir ( "t3code-codex-shadow-root-" ) ;
176+ const shadowHome = path . join ( shadowRoot , "shadow" ) ;
177+ const sharedDesktopCache = path . join ( sharedHome , "models_cache.codex_work_desktop.json" ) ;
178+ const shadowDesktopCache = path . join ( shadowHome , "models_cache.codex_work_desktop.json" ) ;
179+ const sharedWorkCache = path . join ( sharedHome , "models_cache.codex_work_cca.json" ) ;
180+ const shadowWorkCache = path . join ( shadowHome , "models_cache.codex_work_cca.json" ) ;
181+ const sharedOrbitCache = path . join ( sharedHome , "models_cache.orbit_cca_desktop.json" ) ;
182+ const shadowOrbitCache = path . join ( shadowHome , "models_cache.orbit_cca_desktop.json" ) ;
183+
184+ yield * writeTextFile ( path . join ( sharedHome , "config.toml" ) , 'model = "gpt-5-codex"\n' ) ;
185+ yield * writeTextFile ( sharedDesktopCache , '{"owner":"shared-desktop"}\n' ) ;
186+ yield * writeTextFile ( shadowDesktopCache , '{"owner":"shadow-desktop"}\n' ) ;
187+ yield * writeTextFile ( sharedWorkCache , '{"owner":"shared-work"}\n' ) ;
188+ yield * writeTextFile ( sharedOrbitCache , '{"owner":"shared-orbit"}\n' ) ;
189+ yield * fileSystem . symlink ( sharedWorkCache , shadowWorkCache ) ;
190+
191+ const layout = yield * resolveCodexHomeLayout (
192+ decodeCodexSettings ( {
193+ homePath : sharedHome ,
194+ shadowHomePath : shadowHome ,
195+ } ) ,
196+ ) ;
197+
198+ yield * materializeCodexShadowHome ( layout ) ;
199+ yield * materializeCodexShadowHome ( layout ) ;
200+
201+ const desktopCacheLinkResult = yield * fileSystem
202+ . readLink ( shadowDesktopCache )
203+ . pipe ( Effect . result ) ;
204+
205+ expect ( yield * fileSystem . readFileString ( sharedDesktopCache ) ) . toBe (
206+ '{"owner":"shared-desktop"}\n' ,
207+ ) ;
208+ expect ( yield * fileSystem . readFileString ( shadowDesktopCache ) ) . toBe (
209+ '{"owner":"shadow-desktop"}\n' ,
210+ ) ;
211+ expect ( desktopCacheLinkResult . _tag ) . toBe ( "Failure" ) ;
212+ expect ( yield * fileSystem . exists ( shadowWorkCache ) ) . toBe ( false ) ;
213+ expect ( yield * fileSystem . readFileString ( sharedWorkCache ) ) . toBe (
214+ '{"owner":"shared-work"}\n' ,
215+ ) ;
216+ expect ( yield * fileSystem . exists ( shadowOrbitCache ) ) . toBe ( false ) ;
217+ expect ( yield * fileSystem . readLink ( path . join ( shadowHome , "config.toml" ) ) ) . toBe (
218+ path . join ( sharedHome , "config.toml" ) ,
219+ ) ;
220+ } ) ,
221+ ) ;
222+
168223 it . effect . skipIf ( ! symlinksSupported ) (
169224 "replaces a Codex-created local sqlite maintenance lock with the shared lock" ,
170225 ( ) =>
0 commit comments