@@ -211,9 +211,13 @@ export class ClineProvider
211
211
}
212
212
213
213
// 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
+ }
217
221
}
218
222
219
223
/**
@@ -303,6 +307,25 @@ export class ClineProvider
303
307
}
304
308
}
305
309
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
+
306
329
// Adds a new Task instance to clineStack, marking the start of a new task.
307
330
// The instance is pushed to the top of the stack (LIFO order).
308
331
// When the task is completed, the top instance is removed, reactivating the
0 commit comments