Skip to content

Conversation

@jr
Copy link
Collaborator

@jr jr commented Sep 2, 2025

ClineProvider creation was moved before CloudService which broke the old way of doing things.


Important

Fix cloud profile synchronization in ClineProvider by deferring initialization until CloudService is ready.

  • Behavior:
    • In ClineProvider, defer initializeCloudProfileSync() until CloudService is ready.
    • Add initializeCloudProfileSyncWhenReady() in ClineProvider to handle sync after CloudService initialization.
  • Extension Activation:
    • In extension.ts, call initializeCloudProfileSyncWhenReady() after CloudService is initialized.

This description was created by Ellipsis for b1f2608. You can customize this summary. It will automatically update as commits are pushed.

ClineProvider creation was moved before CloudService which broke
the old way of doing things.
@jr jr requested review from cte and mrubens as code owners September 2, 2025 21:34
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Sep 2, 2025
Copy link
Contributor

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! I've reviewed the changes and this is a clean fix for the race condition between ClineProvider and CloudService initialization. The approach of deferring initialization until CloudService is ready is sound. I have some suggestions for improvement below.


if (CloudService.hasInstance()) {
CloudService.instance.off("settings-updated", this.handleCloudSettingsUpdate)
CloudService.instance.on("settings-updated", this.handleCloudSettingsUpdate)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional? The method removes and then immediately re-adds the "settings-updated" event listener (lines 321-322). This could lead to duplicate listeners if initializeCloudProfileSyncWhenReady() is called multiple times. Consider tracking whether a listener is already registered or using a flag to prevent duplicate registrations.

/**
* Initialize cloud profile synchronization when CloudService is ready
* This method is called externally after CloudService has been initialized
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider enhancing this comment to explain why this deferred initialization pattern is necessary. For example: 'Initialize cloud profile synchronization when CloudService is ready. This method is called externally after CloudService has been initialized to handle the race condition where ClineProvider may be created before CloudService.'

await provider.initializeCloudProfileSyncWhenReady()
} catch (error) {
outputChannel.appendLine(
`[CloudService] Failed to initialize cloud profile sync: ${error instanceof Error ? error.message : String(error)}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error is caught and logged, but should the extension take any recovery action here? If cloud profile sync is critical for certain features, users might want to know if it fails during startup. Consider whether a user notification would be appropriate for this failure case.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 2, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 2, 2025
@jr jr merged commit 59d6e74 into main Sep 2, 2025
25 checks passed
@jr jr deleted the jr/fix-cloud-provider-sync branch September 2, 2025 22:18
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Sep 2, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants