@@ -136,6 +136,16 @@ function resolvePluginRegistrySnapshotMemoKey(
136136 if ( ! canMemoizePluginRegistrySnapshot ( params ) ) {
137137 return undefined ;
138138 }
139+ const persistedReadsEnabled =
140+ params . preferPersisted !== false && ! hasEnvFlag ( env , DISABLE_PERSISTED_PLUGIN_REGISTRY_ENV ) ;
141+ const persistedRegistryFingerprint = persistedReadsEnabled
142+ ? hashJson (
143+ readPersistedInstalledPluginIndexSync ( {
144+ env,
145+ ...( params . stateDir ? { stateDir : params . stateDir } : { } ) ,
146+ } ) ,
147+ )
148+ : "disabled" ;
139149 return hashJson ( {
140150 config : params . config ?? null ,
141151 cwd : process . cwd ( ) ,
@@ -144,12 +154,7 @@ function resolvePluginRegistrySnapshotMemoKey(
144154 preferPersisted : params . preferPersisted ?? null ,
145155 // Plugin manifests are process-stable inside the Gateway, while the persisted
146156 // registry envelope can change through explicit refresh/install flows.
147- registry : hashJson (
148- readPersistedInstalledPluginIndexSync ( {
149- env,
150- ...( params . stateDir ? { stateDir : params . stateDir } : { } ) ,
151- } ) ,
152- ) ,
157+ registry : persistedRegistryFingerprint ,
153158 pluginRoots : fingerprintPluginSourceRoots ( params , env ) ,
154159 stateDir : params . stateDir ? resolveUserPath ( params . stateDir , env ) : null ,
155160 workspaceDir : params . workspaceDir ? resolveUserPath ( params . workspaceDir , env ) : null ,
@@ -440,7 +445,7 @@ export function loadPluginRegistrySnapshotWithMetadata(
440445 const disabledByCaller = params . preferPersisted === false ;
441446 const disabledByEnv = hasEnvFlag ( env , DISABLE_PERSISTED_PLUGIN_REGISTRY_ENV ) ;
442447 const persistedReadsEnabled = ! disabledByCaller && ! disabledByEnv ;
443- const persistedInstallRecordReadsEnabled = ! disabledByEnv ;
448+ const persistedInstallRecordReadsEnabled = persistedReadsEnabled ;
444449 let persistedIndex : InstalledPluginIndex | null ;
445450 if ( persistedInstallRecordReadsEnabled ) {
446451 persistedIndex = readPersistedInstalledPluginIndexSync ( params ) ;
0 commit comments