-
Notifications
You must be signed in to change notification settings - Fork 240
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
Autocomplete: Add feature flags to disable network cache and request recycling #1409
Conversation
@@ -202,7 +203,7 @@ async function doGetInlineCompletions(params: InlineCompletionsParams): Promise< | |||
return null | |||
} | |||
|
|||
// Do not trigger when cusor is at the start of the file ending line, and the line above is empty | |||
// Do not trigger when cursor is at the start of the file ending line and the line above is empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks 🙇♀️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also makes it so that manual completions (which bypass the lastCandidate check) will now cycle through different completions instead of resolving with the same one.
Even if we decide the second cache layer is helpful, let's implement the above behavior 🙏
I want this badly!
@valerybugakov Yeah, I agree! |
This adds two feature flags to control the request manager behavior:
cody-autocomplete-disable-network-cache: When set, it won't cache completion requests anymore. My theory here is that this optimization is no longer necessary and when the first line of cache (the last candidate logic) does not hit, we actually want a new completion to be generated. This also makes it so that manual completions (which bypass the lastCandidate check) will now cycle through different completions instead of resolving with the same one. Note that this can still return the same completion from the backend in which case our ID deduplication logic will still work.
cody-autocomplete-disable-recycling-of-previous-requests: When set, it will not try to complete inflight requests base on the result of previous network requests. Instead, it will abort requests when they are no longer relevent. This was initially added as a mechanism to save latency but there are a few flaws here:
My theory is that this is still relevant to improve UX and should probably receive fixes for i), however, I want to test if this hypothesis is true and it does indeed meaningfully improve the UX (CAR, Latency)
Test plan
Using the keyboard shortcut to trigger a completion will return one from cache:
With
cody-autocomplete-disable-network-cache
on, it will do a request:Writing
function bubbleSort(
slowly will create a recycled result:With
cody-autocomplete-disable-recycling-of-previous-requests
on, the request will take longer and will not be recycled