Skip to content

Fix auto index trigger #1593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 1, 2025
Merged

Fix auto index trigger #1593

merged 5 commits into from
Jul 1, 2025

Conversation

logancyang
Copy link
Owner

@logancyang logancyang commented Jul 1, 2025

Fix a bug where auto indexing triggered 3 times at "Apply".

…d DB operations

- Updated applyPlusSettings to always trigger indexing when applying Plus settings, leveraging internal model change detection.
- Enhanced user notifications in DBOperations for embedding model changes, distinguishing between Copilot Plus and other models.
- Added DEFAULT_FREE_CHAT_MODEL_KEY and DEFAULT_FREE_EMBEDDING_MODEL_KEY to utilize default settings for free users.
- Updated turnOffPlus function to reset models to default free user settings when a user is no longer a Plus subscriber.
- Enhanced settings management to ensure proper model key and chain type are set for free users.
@logancyang
Copy link
Owner Author

bugbot run

cursor[bot]

This comment was marked as outdated.

- Removed console logging of Plus settings in applyPlusSettings for cleaner output.
- Simplified user notification in DBOperations by standardizing the message for embedding model changes, removing specific references to Copilot Plus.
…ings

- Updated applyPlusSettings to explicitly check for changes in the embedding model and trigger indexing accordingly.
- Added logging to track changes in the embedding model during Plus settings application and deactivation.
- Improved handling of circular dependencies by importing VectorStoreManager at runtime.
@logancyang
Copy link
Owner Author

bugbot run

cursor[bot]

This comment was marked as outdated.

… settings

- Added error logging and user notifications when indexing fails after applying Plus settings.
- Improved the clarity of the indexing trigger logic to ensure it only occurs when the embedding model changes.
@logancyang
Copy link
Owner Author

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Redundant Setting Updates in `turnOffPlus()`

In turnOffPlus(), defaultModelKey and defaultChainType are redundantly set. The function calls setModelKey() and setChainType() individually, then immediately calls setSettings() with the same values. This duplicate update can trigger multiple setting change events and unintended side effects, potentially reintroducing the multiple indexing issue this PR aims to fix.

src/plusUtils.ts#L124-L132

// Reset models to default free user models
setModelKey(DEFAULT_FREE_CHAT_MODEL_KEY);
setChainType(DEFAULT_SETTINGS.defaultChainType);
setSettings({
isPlusUser: false,
defaultModelKey: DEFAULT_FREE_CHAT_MODEL_KEY,
embeddingModelKey: DEFAULT_FREE_EMBEDDING_MODEL_KEY,
defaultChainType: DEFAULT_SETTINGS.defaultChainType,
});

Fix in Cursor


Was this report helpful? Give feedback by reacting with 👍 or 👎

@logancyang logancyang merged commit 73bf983 into master Jul 1, 2025
3 checks passed
@logancyang logancyang deleted the fix-auto-index-trigger branch July 1, 2025 19:30
@logancyang logancyang mentioned this pull request Jul 1, 2025
wenzhengjiang pushed a commit that referenced this pull request Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant