You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 48acb46
Browse filesBrowse the repository at this point in the historyBrowse files
fix(provider): compensate every durable store when a profile or mode mutation fails
- deleteProviderProfile aborts before the destructive delete when the pre-delete
settings read fails for anything other than the typed not-found: without the
snapshot there is no way to compensate a later failure.
- deleteProviderProfile snapshots the profile list, the shared selection, and this
view's pin/overlay, and compensates each store that already landed, each awaited
on its own. A rollback that itself fails surfaces a distinct inconsistent-state
error instead of masquerading as the original failure.
- rePinViewLocalStateForDeletedProfile restores an affected sibling view's own pin
when its re-pin write fails.
- handleModeSwitch awaits the shared-mode and view-pin restores independently and
reports an inconsistent-state error when either one fails.
- handleModeSwitch re-checks the cancellation signal once the durable write settles:
a write that lands after the mutation timeout already aborted the run is now
compensated instead of emitted.
- tests: coverage for each path above with a negative control, plus the
openClineInNewTab rejection-then-retry contract.
this.log(`deleteProviderProfile: could not read the settings for '${profileToDelete.name}'; a later failure of the list update cannot be compensated. ${errorinstanceofError ? error.message : String(error)}`)
2523
+
// Abort BEFORE the destructive delete. Without the captured settings there is no
2524
+
// way to put them back if a later durable write fails, so continuing here would
2525
+
// turn a transient read error into permanent profile loss while the persisted list
2526
+
// still named the profile.
2527
+
this.log(
2528
+
`deleteProviderProfile: could not read the settings for '${profileToDelete.name}'; aborting before the deletion because a later failure could not be compensated. ${
this.log(`deleteProviderProfile: the profile-list update failed after the settings were removed; the settings for '${profileToDelete.name}' were restored, so the stored profile list still resolves and the profile was not deleted.`)
2555
2641
}catch(compensationError: unknown){
2556
-
this.log(`deleteProviderProfile: the profile-list update failed AND the settings for '${profileToDelete.name}' could not be restored; the stored list may name a profile with no settings. ${compensationErrorinstanceofError ? compensationError.message : String(compensationError)}`)
2642
+
compensationFailures.push(`settings for the deleted profile: ${describeFailure(compensationError)}`)
// A partially repaired deletion is worse than a reported one: surface it as its
2678
+
// own inconsistent-state error so the caller cannot read it as a clean rollback.
2679
+
this.log(
2680
+
`deleteProviderProfile: the deletion failed AND the rollback was incomplete (${compensationFailures.join("; ")}); the persisted profile state may be inconsistent.`,
2681
+
)
2682
+
thrownewError(
2683
+
`Profile deletion left persisted state inconsistent: ${compensationFailures.join("; ")}. Original failure: ${describeFailure(error)}`,
2684
+
)
2685
+
}
2686
+
2687
+
this.log(
2688
+
`deleteProviderProfile: the deletion failed after durable writes landed; the settings, profile list, shared selection, and view pin were all restored, so the profile was not deleted.`,
2689
+
)
2559
2690
throwerror
2560
2691
}
2561
-
2562
2692
awaitthis.postStateToWebview()
2563
2693
}
2564
2694
@@ -2727,8 +2857,32 @@ export class ClineProvider
2727
2857
values.apiConfiguration=replacementSettings
2728
2858
}
2729
2859
2730
-
// Direct private access: compile-time safe across sibling instances.
0 commit comments