Harden Copilot completion context caching - #14747
Draft
Sean McManus (sean-mcmanus) wants to merge 2 commits into
Draft
Harden Copilot completion context caching#14747Sean McManus (sean-mcmanus) wants to merge 2 commits into
Sean McManus (sean-mcmanus) wants to merge 2 commits into
Conversation
Copilot started reviewing on behalf of
Sean McManus (sean-mcmanus)
September 8, 2026 10:02
View session
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The changes are focused, internally consistent, and cover the identified cache and disposal scenarios with unit tests.
Pull request overview
Hardens Copilot completion-context caching against stale entries and late asynchronous results.
Changes:
- Validates cache entries against caret distance and request policy.
- Invalidates shared cache state on document/configuration changes.
- Safely handles late provider registrations after disposal.
File summaries
| File | Description |
|---|---|
Extension/src/LanguageServer/copilotCompletionContextCache.ts |
Adds generation-aware cache and disposable storage. |
Extension/src/LanguageServer/copilotCompletionContextProvider.ts |
Integrates validation, invalidation, and safe disposal. |
Extension/src/LanguageServer/client.ts |
Shares and clears the provider across clients. |
Extension/test/unit/copilotCompletionContextCache.test.ts |
Tests cache validation, invalidation, and disposal. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Ensures Copilot completion context cache entries are reused only when the caret distance and request options still match. It also invalidates shared cache state on C/C++ document and configuration changes and prevents in-flight computations from repopulating invalidated entries.
Details
Validation