fix: use stable cache key for SSH remote workspaces #6067
+92
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the issue where codebase indexing starts from scratch after closing VS Code when using SSH remote connections.
Problem
When using VS Code Remote SSH, the workspace path might be different between sessions (e.g., due to different temporary mount points or path variations). Since the cache file name was generated using a hash of the workspace path, a different path would result in a different cache file, causing the indexing to start from scratch.
Solution
Instead of using just the workspace path for the cache key, we now use a composite key that includes:
This creates a more stable cache key that persists across SSH sessions where the absolute path might change but the relative structure remains the same.
Changes
CacheManager
to generate a stable cache key using workspace name and relative pathTesting
Fixes #6066
Important
CacheManager
now generates stable cache keys for SSH remote workspaces, preventing unnecessary re-indexing.CacheManager
now generates a stable cache key using workspace name and relative path incache-manager.ts
.cache-manager.spec.ts
for cache key generation under home and outside home directory.os.homedir()
incache-manager.spec.ts
to return a consistent home directory for testing.This description was created by
for 743dc97. You can customize this summary. It will automatically update as commits are pushed.