fix: restore tab-specific mode when loading task from history

- Set tabSpecificMode when restoring task with saved mode
- Set tabSpecificApiConfigName when restoring associated API config
- Ensures tabs maintain independent state even when loading from history
This commit is contained in:
Roo Code 2025-09-16 23:29:43 +00:00
parent 822eca3923
commit 4cd5e20c79

View file

@ -836,6 +836,10 @@ export class ClineProvider
historyItem.mode = defaultModeSlug
}
// Update tab-specific mode
this.tabSpecificMode = historyItem.mode
// Also update global state for backward compatibility
await this.updateGlobalState("mode", historyItem.mode)
// Load the saved API config for the restored mode if it exists.
@ -851,6 +855,8 @@ export class ClineProvider
if (profile?.name) {
try {
// Update tab-specific API config name
this.tabSpecificApiConfigName = profile.name
await this.activateProviderProfile({ name: profile.name })
} catch (error) {
// Log the error but continue with task restoration.