Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Nov 12, 2025

This PR attempts to address Issue #9186. Feedback and guidance are welcome.

Problem

The codebase index was being rebuilt every time the VSCode window was reloaded, even though the index already existed in Qdrant. This caused unnecessary delays for users.

Solution

The existing code already had logic to check for existing indexed data and perform incremental scans instead of full rebuilds. This PR:

  1. Adds detailed logging to help diagnose the index persistence behavior
  2. Enhances code comments to clarify the existing incremental scan logic
  3. Adds comprehensive tests to verify that incremental scans are performed when indexed data exists

Key Changes

  • Added logging in hasIndexedData() method to track when existing data is detected
  • Added logging in orchestrator to show when incremental vs full scans are performed
  • Enhanced comments in manager.ts to clarify the indexing restart logic
  • Added test cases to verify incremental scan behavior on window reload

Testing

  • Added new test cases in orchestrator.spec.ts to verify:
    • Incremental scan is performed when indexed data exists (window reload scenario)
    • Full scan is performed only when collection is newly created
  • All existing tests continue to pass

Notes

The core logic for handling persistent indexes was already in place. The orchestrator checks hasIndexedData() and performs an incremental scan when data exists, which only processes new/changed files since the last index. This PR primarily adds visibility and testing around this existing behavior.

Fixes #9186


Important

Prevents unnecessary re-indexing on VSCode reload by performing incremental scans when indexed data exists, with enhanced logging and tests.

  • Behavior:
    • Prevents unnecessary re-indexing on VSCode window reload by checking existing indexed data in orchestrator.ts.
    • Performs incremental scans when indexed data exists, avoiding full rebuilds.
  • Logging:
    • Adds detailed logging in hasIndexedData() in qdrant-client.ts to track existing data detection.
    • Logs incremental vs full scan decisions in orchestrator.ts.
  • Comments:
    • Enhances comments in manager.ts to clarify indexing restart logic.
  • Testing:
    • Adds test cases in orchestrator.spec.ts to verify incremental scan behavior on window reload and full scan on new collection creation.

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

- Added detailed logging to track index persistence behavior
- Enhanced comments to clarify existing incremental scan logic
- Added tests to verify incremental scan on window reload
- The orchestrator already checks for existing indexed data via hasIndexedData()
  and performs incremental scans instead of full rebuilds when data exists

Fixes #9186
@roomote roomote bot requested review from cte, jr and mrubens as code owners November 12, 2025 02:44
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Nov 12, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Nov 12, 2025

Rooviewer Clock   See task on Roo Cloud

Review completed. Found 1 issue that needs attention.

  • Fix logic bug in manager.ts line 169 where the condition incorrectly restarts indexing when already in "Indexed" state

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 12, 2025
Comment on lines +165 to +169
} else if (needsServiceRecreation && this._orchestrator) {
// Services were recreated but orchestrator exists
// Only restart if not currently indexing
shouldStartOrRestartIndexing =
this._orchestrator.state !== "Indexing" && this._orchestrator.state !== "Indexed"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The condition this._orchestrator.state !== "Indexing" && this._orchestrator.state !== "Indexed" will restart indexing when the orchestrator is already in the "Indexed" state, which contradicts the comment above stating "Only restart if not currently indexing". This could cause unnecessary re-indexing when the window is reloaded and the index is already complete. The condition should be this._orchestrator.state !== "Indexing" to avoid restarting when already indexed.

Fix it with Roo Code or mention @roomote and request a fix.

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. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[BUG] codebase index always Re establish index when I reload vscode window

3 participants