@@ -1364,6 +1364,27 @@ interface TerminalManagerOptions {
13641364 > ;
13651365}
13661366
1367+ const pathsReferToSameDirectory = Effect . fnUntraced ( function * ( left : string , right : string ) {
1368+ if ( left === right ) return true ;
1369+ const fs = yield * FileSystem . FileSystem ;
1370+ // An unavailable unused home cannot add a launch gate. Unknown identity still inspects.
1371+ const [ leftInfo , rightInfo ] = yield * Effect . all ( [
1372+ fs . stat ( left ) . pipe ( Effect . option ) ,
1373+ fs . stat ( right ) . pipe ( Effect . option ) ,
1374+ ] ) ;
1375+ return (
1376+ Option . isSome ( leftInfo ) &&
1377+ Option . isSome ( rightInfo ) &&
1378+ leftInfo . value . type === "Directory" &&
1379+ rightInfo . value . type === "Directory" &&
1380+ Option . isSome ( leftInfo . value . ino ) &&
1381+ Option . isSome ( rightInfo . value . ino ) &&
1382+ leftInfo . value . ino . value > 0 &&
1383+ leftInfo . value . dev === rightInfo . value . dev &&
1384+ leftInfo . value . ino . value === rightInfo . value . ino . value
1385+ ) ;
1386+ } ) ;
1387+
13671388export const resolveProviderInstanceTerminalEnvironment = Effect . fn (
13681389 "terminal.resolveProviderInstanceTerminalEnvironment" ,
13691390) ( function * ( input : {
@@ -1442,30 +1463,17 @@ export const resolveProviderInstanceTerminalEnvironment = Effect.fn(
14421463 : input . cwd + "/" + selected ;
14431464 if (
14441465 recoveryLayout . mode === "authOverlay" &&
1445- selectedPath === recoveryLayout . effectiveHomePath
1446- )
1466+ recoveryLayout . effectiveHomePath &&
1467+ ( yield * pathsReferToSameDirectory ( selectedPath , recoveryLayout . effectiveHomePath ) )
1468+ ) {
1469+ resolved = withCodexSqliteHome ( recoveryLayout , resolved ) ;
14471470 return ;
1448- if ( layout . mode === "direct" ) {
1449- if ( selectedPath === layout . sharedHomePath ) return ;
1450- const fs = yield * FileSystem . FileSystem ;
1451- // An unavailable unused shared home cannot add a launch gate. Unknown identity still inspects.
1452- const [ selectedInfo , sharedInfo ] = yield * Effect . all ( [
1453- fs . stat ( selectedPath ) . pipe ( Effect . option ) ,
1454- fs . stat ( layout . sharedHomePath ) . pipe ( Effect . option ) ,
1455- ] ) ;
1456- if (
1457- Option . isSome ( selectedInfo ) &&
1458- Option . isSome ( sharedInfo ) &&
1459- selectedInfo . value . type === "Directory" &&
1460- sharedInfo . value . type === "Directory" &&
1461- Option . isSome ( selectedInfo . value . ino ) &&
1462- Option . isSome ( sharedInfo . value . ino ) &&
1463- selectedInfo . value . ino . value > 0 &&
1464- selectedInfo . value . dev === sharedInfo . value . dev &&
1465- selectedInfo . value . ino . value === sharedInfo . value . ino . value
1466- )
1467- return ;
14681471 }
1472+ if (
1473+ layout . mode === "direct" &&
1474+ ( yield * pathsReferToSameDirectory ( selectedPath , layout . sharedHomePath ) )
1475+ )
1476+ return ;
14691477 yield * inspectCodexShadowSqlite ( {
14701478 ...layout ,
14711479 mode : "authOverlay" ,
0 commit comments