@@ -2204,8 +2204,7 @@ export class ClineProvider
22042204 let deleteBodySettled : Promise < unknown > = Promise . resolve ( )
22052205 try {
22062206 const enqueued = this . enqueueProviderProfileMutationWithBody ( async ( signal ) => {
2207- // Read the settings inside the queue: a queued activation may have changed the
2208- // active profile since this call was made.
2207+ // Read inside the queue: a queued activation may have changed the active profile.
22092208 const globalSettings = this . contextProxy . getValues ( )
22102209 const deletedActiveProfile = profileToDelete . name === globalSettings . currentApiConfigName
22112210
@@ -2216,18 +2215,15 @@ export class ClineProvider
22162215 }
22172216
22182217 if ( ! deletedActiveProfile ) {
2219- // A timeout may have already fired while this body was queued or while an
2220- // earlier manager call held the lock. Purging now would delete the profile
2221- // after the caller was told the deletion failed.
2218+ // A timeout may have fired while queued or while an earlier manager call held
2219+ // the lock. Purging now would delete the profile after the caller was told it failed.
22222220 if ( signal . aborted ) {
22232221 return
22242222 }
22252223
2226- // Captured before the purge so a timeout that fires while the manager lock is
2227- // held can undo a purge that already committed. Without it the manager would
2228- // drop the profile while the caller was told the deletion failed, and the
2229- // inactive branch never activates a replacement to converge the two stores.
2230- // Best-effort: a manager that cannot produce the profile leaves nothing to undo.
2224+ // Captured before the purge so a timeout firing under the manager lock can undo a
2225+ // committed purge; the inactive branch activates no replacement to converge the
2226+ // two stores. Best-effort: a manager that cannot produce it leaves nothing to undo.
22312227 let undoConfig : ( ProviderSettingsWithId & { name : string } ) | undefined
22322228 try {
22332229 undoConfig = await this . providerSettingsManager . getProfile ( { name : profileToDelete . name } )
@@ -2239,22 +2235,27 @@ export class ClineProvider
22392235 return
22402236 }
22412237
2242- // Purge first so a failing purge fails fast before any ContextProxy write,
2243- // matching the ordering the webview delete path established.
2238+ // Purge first so a failing purge fails fast before any ContextProxy write, matching
2239+ // the ordering the webview delete path established.
22442240 removedModeConfigs = ( await this . providerSettingsManager . deleteConfig ( profileToDelete . name ) )
22452241 . removedModeConfigs
22462242
2247- // A timeout may have fired while the manager lock was held. The purge committed,
2248- // so the caller must not be left with a deleted profile it was told survived:
2249- // undo it instead of returning with the two stores disagreeing.
2243+ // A timeout may have fired under the manager lock. The purge committed, so the
2244+ // caller must not be left with a deleted profile it was told survived: undo it.
22502245 if ( signal . aborted ) {
2251- await this . undoCommittedProviderProfilePurge ( profileToDelete . name , undoConfig , removedModeConfigs )
2246+ await this . undoCommittedProviderProfilePurge (
2247+ profileToDelete . name ,
2248+ undoConfig ,
2249+ removedModeConfigs ,
2250+ )
22522251
22532252 // The undo restored the pre-delete profile, so the manager's view needs mirroring
22542253 // only when it holds a profile the cache never observed. An unconditional write
22552254 // would land a snapshot older than a newer mutation's write and replace it.
22562255 const listApiConfigMeta = await this . providerSettingsManager . listConfig ( )
2257- if ( listApiConfigMeta . length !== ( this . contextProxy . getValues ( ) . listApiConfigMeta ?. length ?? 0 ) ) {
2256+ if (
2257+ listApiConfigMeta . length !== ( this . contextProxy . getValues ( ) . listApiConfigMeta ?. length ?? 0 )
2258+ ) {
22582259 await this . contextProxy . setValues ( {
22592260 listApiConfigMeta,
22602261 modeApiConfigs : await this . providerSettingsManager . getModeApiConfigs ( ) ,
@@ -2328,9 +2329,8 @@ export class ClineProvider
23282329 . removedModeConfigs
23292330
23302331 // Route through the standard activation path so the effective provider settings, mode
2331- // config, and current-task wiring all end up identical to a user activating the
2332- // replacement profile from the webview. The unlocked variant is used because this
2333- // already runs inside the mutation queue.
2332+ // config, and current-task wiring match a user activating the replacement from the
2333+ // webview. The unlocked variant is used because this already runs in the mutation queue.
23342334 await this . activateProviderProfileUnlocked ( { name : profileToActivate } , undefined , signal )
23352335
23362336 // A timeout may have fired while the activation was in flight. The queued rollback is
0 commit comments