Skip to content

Commit 59d6e74

Browse files
authored
Cloud: fix provider syncing (#7603)
ClineProvider creation was moved before CloudService which broke the old way of doing things.
1 parent 2e59347 commit 59d6e74

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,13 @@ export class ClineProvider
211211
}
212212

213213
// Initialize Roo Code Cloud profile sync.
214-
this.initializeCloudProfileSync().catch((error) => {
215-
this.log(`Failed to initialize cloud profile sync: ${error}`)
216-
})
214+
if (CloudService.hasInstance()) {
215+
this.initializeCloudProfileSync().catch((error) => {
216+
this.log(`Failed to initialize cloud profile sync: ${error}`)
217+
})
218+
} else {
219+
this.log("CloudService not ready, deferring cloud profile sync")
220+
}
217221
}
218222

219223
/**
@@ -303,6 +307,25 @@ export class ClineProvider
303307
}
304308
}
305309

310+
/**
311+
* Initialize cloud profile synchronization when CloudService is ready
312+
* This method is called externally after CloudService has been initialized
313+
*/
314+
public async initializeCloudProfileSyncWhenReady(): Promise<void> {
315+
try {
316+
if (CloudService.hasInstance() && CloudService.instance.isAuthenticated()) {
317+
await this.syncCloudProfiles()
318+
}
319+
320+
if (CloudService.hasInstance()) {
321+
CloudService.instance.off("settings-updated", this.handleCloudSettingsUpdate)
322+
CloudService.instance.on("settings-updated", this.handleCloudSettingsUpdate)
323+
}
324+
} catch (error) {
325+
this.log(`Failed to initialize cloud profile sync when ready: ${error}`)
326+
}
327+
}
328+
306329
// Adds a new Task instance to clineStack, marking the start of a new task.
307330
// The instance is pushed to the top of the stack (LIFO order).
308331
// When the task is completed, the top instance is removed, reactivating the

src/extension.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,15 @@ export async function activate(context: vscode.ExtensionContext) {
231231
// Add to subscriptions for proper cleanup on deactivate.
232232
context.subscriptions.push(cloudService)
233233

234+
// Trigger initial cloud profile sync now that CloudService is ready
235+
try {
236+
await provider.initializeCloudProfileSyncWhenReady()
237+
} catch (error) {
238+
outputChannel.appendLine(
239+
`[CloudService] Failed to initialize cloud profile sync: ${error instanceof Error ? error.message : String(error)}`,
240+
)
241+
}
242+
234243
// Finish initializing the provider.
235244
TelemetryService.instance.setProvider(provider)
236245

0 commit comments

Comments
 (0)